View source: R/mod_modifyDatasets.r
combineVariable | R Documentation |
Combine values from several variables into a single value in a mew variable.
combineVariable(dataset, sourceVars = NULL, name = NULL, sep = "_")
dataset |
The standard dataset as produced by |
sourceVars |
Character length two or more. The name of the variables where values should be copied from. |
name |
Character length one. The name of the new variable. |
sep |
Character length one. A character to separate the individual values in the new variable. Set to '""' (empty string) to have no separation between values. |
The resulting new variable can only be a class-variable.
An object of class 'aquap_data' with a new variable in the header.
calculateVariable
Other dataset modification functions:
[,aquap_data-method
,
calculateVariable()
,
generateMergeLabels,aquap_data,aquap_data,character,character-method
,
mergeDatasets,aquap_data,aquap_data,missing-method
## Not run:
fd <- gfd() # load a dataset
fdNew <- combineVariable(fd, c("C_Foo", "C_Bar"), "FooBar")
fdNew <- combineVariable(fd, c("C_Foo", "C_Bar"), "FooBar", sep="*")
# is combining the values of the two variables 'C_Foo' and 'C_Bar' into a new
# variable called 'C_FooBar'.
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.