1.2.3-SNAPSHOT Arrow_down_16x16

conj-rows

incanter.core

  • (conj-rows & args)
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))

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/core.clj:1447 top

(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)
			 b (to-dataset B :transpose true)]
		     (dataset (:column-names a) 
			      (concat (to-list a) (to-list b)))))
	     args)))
Vars in incanter.core/conj-rows: concat defn fn let reduce
Used in 0 other vars

Comments top

No comments for conj-rows. Log in to add a comment.