View source: R/variable.update.R
variables.combine | R Documentation |
Combines one or more variable(s) in a DIGRAM Object.
variables.combine(
do = NULL,
variables.to.combine = NULL,
variable.name = NULL,
variable.label = NULL,
category.names = NULL,
combine.type = c("sum", "or", "xor", "and", "onlyif"),
minimum = NULL,
maximum = NULL,
cutpoints = NULL
)
do |
A digram.object |
variables.to.combine |
The numbers or names of the two or more variables to combine |
variable.name |
Name of the variable (string) |
variable.label |
Label of the variable (one or more uppercase letters) |
combine.type |
How to combine the variables. Values are: "sum": add values of ingoing variables together "or": if one of the variables has a value other than 0, use it (in case of polytomous values, use the highest) "xor": if ONLY one of the variables has a value other than 0, use it "and": if ALL variables has the same value, use it "onlyif" if the first variable has a value, use it. If the second has a value, add it to the first. If the third has a value ... etc. |
minimum |
Smallest value of the variable (lower values are coded NA) |
maximum |
Largest value of the variable (lower values are coded NA) |
cutpoints |
Cutpoints used to recode the variable Category 1: minimum <= values <= cutpoint(1) Category 2: cutpoint(1) < values <= cutpoint(2) ... Category N: cutpoint(n) < values <= maximum |
Only ordinal variables can be combined. The resulting variable can be manipulated and deleted as ordinary variables using variable.update and variable.delete.
Returns a DIGRAM object with the new combined variable.
Jeppe Bundsgaard jebu@edu.au.dk
data(DHP)
DHP<-variables.combine(do=DHP,variables.to.combine=c("dhp36","dhp34"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.