combineVariable: Combine Variable

View source: R/mod_modifyDatasets.r

combineVariableR Documentation

Combine Variable

Description

Combine values from several variables into a single value in a mew variable.

Usage

combineVariable(dataset, sourceVars = NULL, name = NULL, sep = "_")

Arguments

dataset

The standard dataset as produced by gfd.

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.

Details

The resulting new variable can only be a class-variable.

Value

An object of class 'aquap_data' with a new variable in the header.

See Also

calculateVariable

Other dataset modification functions: [,aquap_data-method, calculateVariable(), generateMergeLabels,aquap_data,aquap_data,character,character-method, mergeDatasets,aquap_data,aquap_data,missing-method

Examples

## 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)

bpollner/aquap2 documentation built on March 29, 2024, 7:33 a.m.