Binds the given data to $data and executes the body.
Typically used with the $ and $where functions.
Examples:
(use '(incanter core stats charts datasets))
(with-data (get-dataset :cars)
(def lm (linear-model ($ :dist) ($ :speed)))
(doto (scatter-plot ($ :speed) ($ :dist))
(add-lines ($ :speed) (:fitted lm))
view))
;; create a dataset where :speed greater than 10 or less than -10
(with-data (get-dataset :cars)
(view (-> ($where {:speed {:$gt 20}})
(conj-rows ($where {:speed {:$lt 10}})))))
Comments top
No comments for with-data. Log in to add a comment.