hello,

This

rbindlist(list(list(a=NA,b=NA),list(a=20,b=FALSE)))

returns

      a     b
1:   NA    NA
2: TRUE FALSE

as per the documentation ?rbindlist

is there a way to specify the column class of 'a' to be numeric?
In actual usage, i wont be able to re-order the 2nd list entry to be the
first.

I did try

rbindlist(list(list(a=numeric(0),b=logical(0),list(a=NA,b=NA),list(a=20,b=FALSE)))

but got

      a     b
1:   NA    NA
2: TRUE FALSE

This worked

mu  =
rbindlist(list(list(a=numeric(1),b=logical(1),list(a=NA,b=NA),list(a=20,b=FALSE)))
mu = mu[-1,]

Is there a way to specify up front the classes rather than the last approach

Regards
Saptarshi

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to