R/AllGenerics.R
, R/weight.R
modifyWeightVariables.Rd
modifyWeightVariables
allows you to change the variables which are eligible
to be used as a dataset's weight. You can also add variables to the weight variables
catalog by assignment with weightVariables(ds) <- "weight"
or
is.weightVariable(ds$weight) <- TRUE
.
weightVariables(x) <- value
is.weightVariable(x) <- value
modifyWeightVariables(x, vars, type = "append")
# S4 method for CrunchDataset
weightVariables(x) <- value
is.weightVariable(x)
# S4 method for NumericVariable
is.weightVariable(x) <- value
a CrunchDataset
For the weightVariables()
and is.weightVariable
setters the
variables to append to a dataset's weightVariables.
Variables to add or remove this can be a numeric Crunch variable,
list of numeric Crunch variables or a character vector with the aliases of
numeric Crunch variables. Setting vars to NULL
clears a datasets weightVariables
a character string determining how the weightVariables will be modified:
"append"
: add vars
to the current weight variables
"remove"
: remove vars
from the current list of weight variables
"replace"
: replace the current weight variables with vars
a CrunchDataset
Editors can change which variables can be set as the weighting variable
for a dataset. For instance if several weights have been calculated they
can let the user choose which of those variables to use a weight, but prevent
the user from choosing other variables as weight. This function allows you
to change the weightVariables
of a dataset.
if (FALSE) {
modifyweightVariables(ds, "weight", "append")
weightVariables(ds) <- list(ds$weight, ds$weight2)
weightVariables(ds) <- NULL
weightVariables(ds) <- c("weight", "weight2")
is.weightVariables(ds$weight) <- TRUE
}