fac_dispatcher | R Documentation |
Ease various specifications for fac specification when passed to Momocs objects. Intensively used (internally).
fac_dispatcher(x, fac)
x |
a Momocs object (any |
fac |
a specification to extract from |
fac
can be:
a factor, passed on the fly
a column id from $fac
a column name from fac
; if not found, return NULL
with a message
a formula in the form: ~column_name
(from $fac
, no quotes).
It expresses more in a concise way. Also allows interacting on the fly. See examples.
a NULL
returns a NULL
, with a message
a prepared factor
(or a numeric
). See examples
Other handling functions:
arrange()
,
at_least()
,
chop()
,
combine()
,
dissolve()
,
filter()
,
mutate()
,
rename()
,
rescale()
,
rm_harm()
,
rm_missing()
,
rm_uncomplete()
,
rw_fac()
,
sample_frac()
,
sample_n()
,
select()
,
slice()
,
subsetize()
bot <- mutate(bot, s=rnorm(40), fake=factor(rep(letters[1:4], 10)))
# factor, on the fly
fac_dispatcher(bot, factor(rep(letters[1:4], 10)))
# column id
fac_dispatcher(bot, 1)
# column name
fac_dispatcher(bot, "type")
# same, numeric case
fac_dispatcher(bot, "s")
# formula interface
fac_dispatcher(bot, ~type)
# formula interface + interaction on the fly
fac_dispatcher(bot, ~type+fake)
# when passing NULL or non existing column
fac_dispatcher(42, NULL)
fac_dispatcher(bot, "loser")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.