Coder Social home page Coder Social logo

Comments (4)

davidjameshumphreys avatar davidjameshumphreys commented on July 18, 2024

I tried to look at changing the conj-rows function, but I was unable to alter it without causing more bugs (sel and $ don't return a dataset for just one row).

This function could be used within conj-rows:
(conj-rows
ab-dataset
(reorder-columns ba-dataset [:a :b]))

The conj-rows documentation should be updated to reflect the fact that it has some limitations with respect to column order.

from incanter.

alexott avatar alexott commented on July 18, 2024

@avishn does this still issue for you?

from incanter.

alexott avatar alexott commented on July 18, 2024

closed as implemented...

from incanter.

yubrshen avatar yubrshen commented on July 18, 2024

@alexott
What's the rational not fixing conj-rows at it's root? It seems to me that it's possible to do so. For example, how about

(defn conj-rows
  "Returns a dataset created by combining the rows of the given datasets   and/or collections.
   Examples:
     (use '(incanter core datasets))
     (def cars (get-dataset :cars))
     (view (conj-rows (to-dataset (range 5)) (to-dataset (range 5 10))))
     (view (conj-rows cars cars))
     (view (conj-rows [[1 2] [3 4]] [[5 6] [7 8]]))
     (view (conj-rows [{:a 1 :b 2} {:a 3 :b 4}] [[5 6] [7 8]]))
     (view (conj-rows (to-dataset [{:a 1 :b 2} {:a 3 :b 4}]) [[5 6] [7 8]]))
     (conj-rows (range 5) (range 5 10))
"
  ([& args]
     (reduce (fn [A B]
               (let [a (to-dataset A :transpose true)
                     the-column-names (:column-names a)
                     b (reorder-columns (to-dataset B :transpose true) the-column-names)]
                 (dataset the-column-names
                          (concat (to-list a) (to-list b)))))
             args)))

I wasted several hours to track down to conj-rows' peculiar behavior, by looking at the source code.

Fixing conj-rows' documentation would be helpful, but I wish to remove the burden to user as much as possible. This is a typical incidental complexity, that the user should not bear, if possible.

If you think that there is no negative impact, I can take care of the regression test for the fix. (This is how I fix it for my application.)

Thanks,

Yu

from incanter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.