I am stuck with a small R issue with data.table. Your help is much
appreciated. How do I do this:
get <- function(dt, expr, gby) {
e <- substitute(expr)
b <- substitute(gby)
return(dt[,eval(e),by=b])
}
v1 <- "Sepal.Length"
v2 <- "Species"
dt <- data.table(iris)
rDT <- get(dt, sum(v1, na.rm=TRUE), v2)
I get following error: Error in sum(v1, na.rm = TRUE) : invalid 'type'
(character) of argument
Now, both v1 and v2 get passed from other program as character variable so
I can't do this v1<- quote(Sepal.Length) which seems to work.
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help