by_scale {doBy} | R Documentation |
Scale a dataframe or matrix
Description
Split a dataframe into a list according to the levels of variables in the dataframe and scale the numeric variables in each dataframe in the list.
Usage
scaleBy(formula, data = parent.frame(), center = TRUE, scale = TRUE)
scale_by(data, formula, center = TRUE, scale = TRUE)
Arguments
formula |
Variables to split data frame by, as |
data |
A dataframe or matrix |
center |
Logical, should data be centered. |
scale |
Logical, should data be scaled. |
Value
A list of objects of same class as x
Author(s)
Søren Højsgaard, sorenh@math.aau.dk
See Also
orderBy
, order_by
,
summaryBy
, summary_by
,
transformBy
, transform_by
Examples
scaleBy(~Species, data=iris, center=TRUE, scale=FALSE)
scaleBy(~1, data=iris, center=TRUE, scale=FALSE)
scale_by(iris, ~Species)
scale_by(iris, ~1)
## Not combine list of dataframes to one dataframe e.g. as:
a <- scale_by(iris, ~Species)
d <- do.call(rbind, a)
[Package doBy version 4.6.22 Index]