splitBy {doBy} | R Documentation |
This is essentially a wrapper for the 'split' function, - the important difference being that variables to order by can be given by a model formula.
splitBy(formula, data = parent.frame(), drop=TRUE, return.matrix=FALSE)
formula |
The right hand side of a formula |
data |
A data frame |
drop |
Logical indicating if levels that do not occur should be dropped |
return.matrix |
Should the returned list consist of dataframs or matrices, see 'details' below |
The funcion transform the dataframe 'data' into a numerical matrix (using the 'asNumericMatrix' function from the Hmisc package) and makes the splitting operation on this. If return.matrix is TRUE, then these matrices are returned, otherwise the matrices are turned into dataframes and then these are returned.
A list of dataframes of matrixes
Søren Højsgaard, sorenh@agrsci.dk
orderBy
,
summaryBy
,
transformBy
,
doby.xtabs
,
data(dietox) splitBy(formula = ~Evit+Cu, data = dietox)