asFactorDS {dsBase} | R Documentation |
this function is similar to R function as.factor
except for the fact that it does not allow for levels with
one observation only.
asFactorDS(x = character(), levels, labels = levels, exclude = NA, ordered = is.ordered(x))
x |
a vector of data, usually taking a small number of distinct values. |
levels |
an optional vector of the values (as character strings) that x might have taken. |
labels |
either an optional character vector of labels for the levels (in the same order as levels after removing those in exclude), or a character string of length 1. |
exclude |
a vector of values to be excluded when forming the set of levels. This should be of the same type as x, and will be coerced if necessary. |
ordered |
logical flag to determine if the levels should be regarded as ordered (in the order given). |
an object of class 'factor' or NULL if the resulting factor is invalid
Burton, P.; Gaye, A.