Returns a map of type incanter.core.dataset constructed from the given column-names and
data. The data is either a sequence of sequences or a sequence of hash-maps.
(defn dataset
" Returns a map of type incanter.core.dataset constructed from the given column-names and
data. The data is either a sequence of sequences or a sequence of hash-maps.
"
([column-names & data]
(let [dat (cond
(or (map? (ffirst data)) (coll? (ffirst data)))
(first data)
(map? (first data))
data
:else
(map vector (first data)))
rows (cond
(map? dat)
[dat]
(map? (first dat))
dat
:else
(map #(apply assoc {} (interleave column-names %)) dat))]
(Dataset. (into [] column-names) rows))))
Comments top
No comments for dataset. Log in to add a comment.