Description Usage Arguments Details Examples
Enhanced control for combining values
1 |
... |
objects to be concatenated. |
recursive |
logical. If |
This function returns the same as base c
, but if all
elements of ...
are of class factor or ordered, it returns the lowest
common denominator, i.e. an object of class ordered or factor.
Ordering of the levels (also for unordered factors) is only preserved if it
is identical accross all element in ...
. Otherwise, it is determined
by cfactor
, which is called internarlly. Refer to the section
'Details' in the cfactor
documentation for further details.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | char1 <- as.factor(sample(letters, 5))
char2 <- as.factor(sample(letters, 5))
cc(char1, char2) # probably more reasonable than
c(char1, char2)
## Not run:
## warnings
# no warning since levels identical
a_to_d <- cfactor(letters[1:2], levels = letters[1:5])
b_to_d <- cfactor(letters[1:5])
cc(a_to_d, b_to_d)
# warning for differing order of levels
a_to_d <- cfactor(letters[1:2], levels = letters[1:5])
d_to_a <- cfactor(letters[1:2], levels = rev(letters[1:5]))
cc(a_to_d, d_to_a)
# warning for different levels
some_levels <- cfactor(letters[1:2], levels = letters[1:5])
all_levels <- cfactor(letters[1:2], levels = letters)
cc(all_levels, some_levels, some_levels)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.