Description Usage Arguments Details Value Author(s) Examples
Recode the content of a column (variable) of GDS. GDS is the Global DataSet.
1 |
x |
- a string value, the name of the column to be recoded |
where |
- a list of logical expressions |
by |
- a list of values matching the list of logical expressions. Originals values will be replaced by these |
gen |
- optional string, the name of the new column |
TODO
Return nothing. GDS the Global DataSet is modified
jp.decorps@epiconcept.fr
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # -----------------------------------------------------------
# Recode the 'carb' column with 0 if carb is lower than 3
# and with 1 if 'carb' higher or equal than 3
# -----------------------------------------------------------
data(mtcars)
ec.Use(mtcars);
str(GDS)
ec.Recode("carb", where = list(VAL("carb") < 3, VAL("carb") >= 3), by=list(0,1))
str(GDS)
# -----------------------------------------------------------
# Create a new column (variable) named 'carGroup' which contains the
# recoding of the 'carb' column. The 'carb' column is not modified.
# -----------------------------------------------------------
data(mtcars)
ec.Use(mtcars);
str(GDS)
ec.Recode("carb", where = list(VAL("carb") < 3, VAL("carb") >= 3), by=list(0,1), gen="carbGroup")
str(GDS)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.