Description Usage Arguments Details
Often, objects of a large size repeating themselves need to be stored in a
data frame. fx_factor
provides a simple framework to work with these
objects in a space-saving manner - at least until the modeling and
visualization.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | fx_factor(x, levels = unique(x))
as_fx_factor(x_int, levels)
is_fx_factor(x)
## S3 replacement method for class 'fx_factor'
levels(x) <- value
## Default S3 method:
fx_evaluate(x)
## S3 method for class 'fx_factor'
fx_evaluate(x)
## S3 method for class 'data.frame'
fx_evaluate(x)
## S3 method for class 'metaframe'
fx_evaluate(x)
## S3 method for class 'fx_factor'
x[i]
## S3 method for class 'fx_factor'
x[[i]]
|
x |
a vector or a list |
levels |
a set of possible, unique objects that may occur in x |
x_int |
an integer vector referring to the levels |
Levels inference is more complicated for arbitrary classes. Requiring
identical() may be too much (e. g.
identical(ggplot2::geom_point(), ggplot2::geom_point())
) whereas match()
(matching) might be too lax (e. g.
match(list(ggplot2::geom_point()), list(ggplot2::geom_point(stat = "log10"))
).
If in doubt, using as_fx_factor
is recommended and fx_factor
will return
an error if encoding and decoding changes the result according to identical
(with the argument ignore.environment = TRUE
).
Also, all elements of x
must occur in levels
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.