[datatable-help] := and ':=" throwing errors
Cron Acronis
cronacronis at gmail.com
Mon Mar 21 09:16:23 CET 2016
On Sun, 20 Mar 2016 22:55:33 -0700, carlsutton wrote:
> My goal is to create proportions for several variables, by group, and
> save these in new columns. So far I have spent most of the day
> researching this, retaking the Data Camp data table course, and all
> iterations have failed miserably. Several google searches were not
> helpful. Console out put (code and error messages below. Hopefully.
> Proportions.R
> <http://r.789695.n4.nabble.com/file/n4718825/Proportions.R>
> <http://r.789695.n4.nabble.com/file/n4718825/Capture.png>
>
> Carl Sutton
>
>
>
> -----
> Carl Sutton
Try this:
dt1[, ':='(propta = sum(a)/.N, propt.b = sum(b)/.N), by = c]
More information about the datatable-help
mailing list