rw_fac | R Documentation |
rw_fac stands for 'rewriting rule'. Typically useful to correct typos at the import, or merge some levels within covariates. Drops levels silently.
rw_fac(x, fac, from, to)
x |
any Momocs object |
fac |
the id of the name of the $fac column to look for (fac_dispatcher not yet supported) |
from |
which level(s) should be renamed; passed as a single or several characters |
to |
which name should be used to rename this/these levels |
a Momocs object of the same class
Other handling functions:
arrange()
,
at_least()
,
chop()
,
combine()
,
dissolve()
,
fac_dispatcher()
,
filter()
,
mutate()
,
rename()
,
rescale()
,
rm_harm()
,
rm_missing()
,
rm_uncomplete()
,
sample_frac()
,
sample_n()
,
select()
,
slice()
,
subsetize()
# single renaming
rw_fac(bot, "type", "whisky", "agua_de_fuego")$type # 1 instead of "type" is fine too
# several renaming
bot2 <- mutate(bot, fake=factor(rep(letters[1:4], 10)))
rw_fac(bot2, "fake", c("a", "e"), "ae")$fake
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.