Quantcast

using character vector as input argument to setkey (data.table pakcage)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

using character vector as input argument to setkey (data.table pakcage)

Sean Zhang
Dear R helpers,

I wonder how to use a character vector as an input argument to setkey
(data.table package).
The following works:

library(data.table)
test.dt <- data.table(expand.grid(a=1:30,b=LETTERS),c=seq(30*26))
setkey(test.dt,a,b)

I like a similar function, but can accept c('a','b') as an input argument as
below
setkey.wanted(test.dt,c('a','b'))

Your help will be highly appreciated.

-Sean

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Loading...