Description Usage Arguments Details Value Examples
Vector Merging
1 |
x |
the vector to be modified. |
values |
to be included in the modified vector. |
after |
a subscript, after which the values are to be appended. |
A refined version of append
that allows for
factor appending.
If x
and values
are of class factor
,
the function returns an object of class factor
whereas levels are
determined using cfactor
internally. Levels are only
preserved if both elements have the same levels. In addition, ordering
is only preserved if the order is also identical.
Otherwise, the base
method is called directly.
1 2 3 4 5 6 7 8 9 10 | f <- factor(c('c','a','a',NA,'b','a'), levels= c('a','b','c'))
g <- factor(sample(letters[4:10]), levels = sample(letters[4:10]))
base::append(f, g) # not nice
refactor::append(f, g) # probably what you want
# ordered factors
f_ord <- factor(f, ordered = TRUE)
g_ord <- factor(g, ordered = TRUE)
append(f_ord, g_ord)
append(f_ord, f_ord)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.