An alias to (sel (second args) :cols (first args)). If given only a single argument,
it will use the $data binding for the first argument, which is set with
the with-data macro.
Examples:
(use '(incanter core stats charts datasets))
(def cars (get-dataset :cars))
($ :speed cars)
(with-data cars
(def lm (linear-model ($ :dist) ($ :speed)))
(doto (scatter-plot ($ :speed) ($ :dist))
view
(add-lines ($ :speed) (:fitted lm))))
;; standardize speed and dist and append the standardized variables to the original dataset
(with-data (get-dataset :cars)
(view (conj-cols $data
(sweep (sweep ($ :speed)) :stat sd :fun div)
(sweep (sweep ($ :dist)) :stat sd :fun div))))
(with-data (get-dataset :iris)
(view $data)
(view ($ [:Sepal.Length :Sepal.Width :Species]))
(view ($ [:not :Petal.Width :Petal.Length]))
(view ($ 0 [:not :Petal.Width :Petal.Length])))
(use 'incanter.core)
(def mat (matrix (range 9) 3))
(view mat)
($ 2 2 mat)
($ [0 2] 2 mat)
($ :all 1 mat)
($ 1 mat)
($ [:not 1] mat)
($ 0 :all mat)
($ [0 2] [0 2] mat)
($ [:not 1] [:not 1] mat)
($ [:not 1] :all mat)
($ [0 2] [:not 1] mat)
($ [0 2] [:not 1 2] mat)
($ [0 2] [:not (range 2)] mat)
($ [:not (range 2)] [0 2] mat)
(with-data mat
($ 0 0))
(with-data mat
($ [0 2] 2 mat))
(with-data mat
($ :all 1))
(with-data mat
($ [0 2] [0 2]))
(with-data mat
($ [:not 1] :all))
(with-data mat
($ [0 2] [:not 1]))
(use 'incanter.datasets)
(view (get-dataset :cars))
($ (range 5) 0 (get-dataset :cars))
($ (range 5) :all (get-dataset :cars))
($ :all (range 2) (get-dataset :cars))
($ (range 5) :dist (get-dataset :cars))
($ [:not (range 5)] 0 (get-dataset :cars))
($ [:not 0 1 2 3 4] 0 (get-dataset :cars))
(with-data (get-dataset :cars)
($ 0 :dist))
(with-data (get-dataset :hair-eye-color)
(view $data)
(view ($ [:not :gender])))
Comments top
No comments for $. Log in to add a comment.