Hi,
I'm trying to split a data.table and then update the individual
splits. Does anyone have an idea, why this doesn't work?
Thanks,
Sebastian
library(data.table)
## this doesn't work
q <- list(data.table(runif(9)),data.table(runif(9)))
lapply( q, function(xx) { qq <- split(xx, 1:nrow(xx) %/% 5)
lapply(qq, function(xx) { xx[, freq:=.N, by="V1"] })
})
## this doesn't work either although freq now exists
q <- list(data.table(runif(9)),data.table(runif(9)))
lapply(q, function(xx) xx[,freq:=-1] )
lapply( q, function(xx) { qq <- split(xx, 1:nrow(xx) %/% 5)
lapply(qq, function(xx) { xx[, freq:=.N, by="V1"] })
})
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help