NOTE: this solution requires Incanter 1.5.3 or greater
For those who can use recent versions of Incanter...
add-column & add-derived-column were added to Incanter in 1.5.3 (pull request)
From the docs:
"Adds a column, with given values, to a dataset."
(add-column column-name values)
or
(add-column column-name values data)
Or you can use:
"This function adds a column to a dataset that is a function of
existing columns. If no dataset is provided, $data (bound by the
with-data macro) will be used. f should be a function of the
from-columns, with arguments in that order."
(add-derived-column column-name from-columns f)
or
(add-derived-column column-name from-columns f data)
a more complete example
(use '(incanter core datasets))
(def cars (get-dataset :cars))
(add-derived-column :dist-over-speed [:dist :speed] (fn [d s] (/ d s)) cars)
(with-data (get-dataset :cars)
(view (add-derived-column :speed**-1 [:speed] #(/ 1.0 %))))