CompositeData | R Documentation |
An constructor function for the S4 CompositeData class
CompositeData(rawdata, groups, thresholds, higherisbetter, k, rawtrans)
rawdata |
A data frame with at least one row and column |
groups |
an optional character vector. If omitted defaults to a character vector of all “one”s. |
thresholds |
an optional named list where names match the names in groups. If using defaults for groups, should name it “one”. |
higherisbetter |
an optional logical vector |
k |
an optional integer, the number of columns in the raw data |
rawtrans |
A list of functions to transform the raw data (and thresholds).
This list should be in the same order as the variables. For variables
that should not be transformed, use: |
An S4 object of class “CompositeData”
## no custom raw data transformations d <- CompositeData(mtcars[, c("mpg", "hp", "wt", "qsec")], thresholds = list(one = with(mtcars, c( mpg = max(mpg), hp = max(hp), wt = min(wt), qsec = min(qsec))) ), higherisbetter = c(TRUE, TRUE, FALSE, FALSE)) ## square root transform qsec d <- CompositeData(mtcars[, c("mpg", "hp", "wt", "qsec")], thresholds = list(one = with(mtcars, c( mpg = max(mpg), hp = max(hp), wt = min(wt), qsec = min(qsec))) ), higherisbetter = c(TRUE, TRUE, FALSE, FALSE), rawtrans = list( mpg = function(x) x, hp = function(x) x, wt = function(x) x, qsec = sqrt)) ## cleanup rm(d)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.