View source: R/scalevariableset.R
numbersFromCategoricalVariableSets | R Documentation |
Extracts the codeframe and value attributes from the (R data.frame/factor representation of) Displayr's Categorical Variable Sets (PickOne and PickOneMulti questions in Q) and applies them to the input factors/data.frame to convert it to its underlying values.
numbersFromCategoricalVariableSets(x)
x |
A variable set from Q/Displayr (an R factor or data.frame with special attributes). |
levels(x) are always present in the names of the codeframe attribute, unless codes are hidden. The codeframe contains sourcevalues for each code/level, which need to be mapped from the sourcevalues attribute (original values as read in with the data set) to the (possibly user-modified) values attribute.
A level that is the result of a merge will contain multiple source values for that element in the codeframe. These are mapped to the corresponding underlying values in the values attribute and averaged.
For data.frame (vector) x
, A matrix (vector) of
numeric values with number of rows (elements) equal to
NROW(x)
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.