[datatable-help] using functions which return a vector

Matt Pocernich matt_pocernich at hotmail.com
Fri Aug 31 00:29:10 CEST 2012


Hello,

Sorry for the simple question, but how do I use a function, such as quantile, which returns multiple values.

For example,

data(iris)
IRIS  <- as.data.table(iris)
IRIS[, quantile(Sepal.Length), by = Species]

## returns the following.
       Species    V1
 1:     setosa 4.300
 2:     setosa 4.800
 3:     setosa 5.000
 4:     setosa 5.200
 5:     setosa 5.800
 6: versicolor 4.900
 7: versicolor 5.600
 8: versicolor 5.900
....

I would like the values returned as columns or a vector with the column names returned by the quantile function.

Thanks,

Matt
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20120830/19234f69/attachment.html>


More information about the datatable-help mailing list