1.2.3-SNAPSHOT Arrow_down_16x16

to-matrix

incanter.core

  • (to-matrix dataset & options)
Converts a dataset into a matrix. Equivalent to R's as.matrix function
for datasets.

Options:
:dummies (default false) -- if true converts non-numeric variables into sets
of binary dummy variables, otherwise converts
them into numeric codes.

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:2194 top

(defn to-matrix
"  Converts a dataset into a matrix. Equivalent to R's as.matrix function
   for datasets.

  Options:
    :dummies (default false) -- if true converts non-numeric variables into sets
                                of binary dummy variables, otherwise converts
                                them into numeric codes.
"
  ([dataset & options]
    (let [opts (when options (apply assoc {} options))
          dummies? (if (true? (:dummies opts)) true false)]
      (reduce bind-columns
              (map #(string-to-categorical dataset % dummies?)
                    (range (count (keys (:column-names dataset)))))))))
Vars in incanter.core/to-matrix: count defn keys let map range reduce
Used in 0 other vars

Comments top

No comments for to-matrix. Log in to add a comment.