Description Usage Arguments Details Value Author(s) See Also Examples
wideByFactor
modifies data.frame in such a way that variables are
“separated” into several columns by factor levels.
1 | wideByFactor(x, factor, common, sort=TRUE, keepFactor=TRUE)
|
x |
data frame |
factor |
character, column name of a factor by which variables will be divided |
common |
character, column names of (common) columns that should not be divided |
sort |
logical, sort resulting data frame by factor levels |
keepFactor |
logical, keep the ‘factor’ column |
Given data frame is modified in such a way, that output represents a data frame with c + f + n * v columns, where c is a number of common columns for all levels of a factor, f is a factor column, n is a number of levels in factor f and v is a number of variables that should be divided for each level of a factor. Number of rows stays the same!
A data frame where divided variables have sort of “diagonalized” structure
Gregor Gorjanc
reshape
in the stats package,
melt
and cast
in
the reshape package
1 2 3 4 5 6 7 8 9 10 11 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.