View source: R/fill-variable.R
fillExpr | R Documentation |
Given a categorical variable, assign one or more categories to be filled in by another existing variable or crunch expression. (Categories not filled in will remain unchanged ).
fillExpr(x, fills, ..., data = NULL, type = NULL)
x |
a Categorical (Array) variable |
fills |
a list of lists that each have a "fill" item that is a variable or expression as well as one of an "id", "name", or "value" that will be matched to the categories of x If x is an expression, the fills must be an id |
... |
A sequence of named expressions or variables to use as fills, where the name will be matched to the existing categories |
data |
(optional) a crunch dataset to use. Specifying this means you don't have to put
|
type |
The type of the variable to output (either "categorical" or "numeric"), only required if all fills are expressions and so their type cannot be guessed automatically. |
A CrunchExpression
that assigns categories to filling variables
## Not run:
fillExpr(
ds$v1,
fills = list(
list(fill = ds$v2, name = "dog")
)
)
fillExpr(v1, "dog" = ds$v2)
# the dataset can be specified with data=
fillExpr(v1, "dog" = v2, data = ds)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.