scaleBy | R Documentation |
Splits a data frame or matrix by grouping variables and scales numeric variables within each group.
scaleBy(formula, data = parent.frame(), center = TRUE, scale = TRUE)
scale_by(data, formula, center = TRUE, scale = TRUE)
formula |
Grouping structure: a formula, character vector, or variables as |
data |
A data frame or matrix. |
center |
Logical; if TRUE, center the variables. |
scale |
Logical; if TRUE, scale the variables. |
A list of data frames or matrices (same class as input), one per group.
Søren Højsgaard, sorenh@math.aau.dk
summaryBy
, transformBy
, orderBy
scale_by(iris, ~Species)
scale_by(iris, ~1)
## Combine result into one data frame:
a <- scale_by(iris, ~Species)
d <- do.call(rbind, a)
## Old interface
scaleBy(~Species, data = iris, center = TRUE, scale = FALSE)
scaleBy(~1, data = iris)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.