Hi together,
I use spaces when I separate columns in the by-argument, but with version
1.8.0 that does not work anymore:
library(data.table)
DT <- data.table(A = rep(letters[1:10], each=5),
B = rep(1:10, times=5),
C = rnorm(50))
DT[, .N, by="A, B"] #does not work, but used to work before
DT[, .N, by="A,B"] #does work
Is this on purpose? Or is this a minor bug, probably introduced when bug
#1880 was fixed (see NEWS of v1.8.0):
* 'by' was failing (bug #1880) when passed character column names where
one or more included a space. So, this now works :
DT[,sum(v),by="column 1"]
and j retains spaces in column names rather than replacing spaces with
"."; e.g.,
DT[,list("a b"=1)]
Thanks to Yang Zhang for reporting. Tests added. As before, column names
may be back ticked in the usual R way (in i, j and by); e.g.,
DT[,sum(`nicely named var`+1),by=month(`long name for date column`)]
If it's the latter, let me know. I'll raise a bug report.
Christoph
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help