home *** CD-ROM | disk | FTP | other *** search
-
- _F_a_c_t_o_r _V_a_r_i_a_b_l_e_s
-
- factor(x, levels=sort(unique(x)), labels,
- ordered=FALSE, exclude=NA)
- ordered(x, levels=sort(unique(x)), labels, exclude=NA)
-
- is.factor(x)
- is.ordered(x)
- is.unordered(x)
-
- as.factor(x, ordered=FALSE)
-
- _V_a_l_u_e:
-
- The function factor is used to encode a vector as a
- factor (the names category and enumerated type are also
- used for factors). If ordered is TRUE, the factor lev-
- els are assumed ordered. By default the levels are
- unordered. For compatibility purposes, there is also a
- function called ordered which provides an alternative
- way of creating ordered factors.
-
- The encoding of the vector happens as follows: if
- x[i]==levels[j] then the i-th element of the result is
- j. If no match is found for x[i] in levels, then the
- i-th element of the result is set to NA. Any values
- listed in exclude result in NAs appearinging in the
- returned factor. If exclude is set to a zero length
- vector, then any NA values in x are used for form a new
- level for the factor. This means that there will be no
- NA values in the result.
-
- labels is a vector of character strings used to label
- the levels of the factor. The default is to use the
- encoded factor levels.
-
- is.factor returns TRUE or FALSE depending on whether
- its argument is of type factor or not. Correspond-
- ingly, is.ordered (is.unordered) returns TRUE when its
- argument is ordered (unordered) and FALSE otherwise.
-
- as.factor coerces its argument to a factor. It is an
- abbreviated form of factor.
-
- _S_e_e _A_l_s_o:
-
- gl, levels, nlevels.
-
-