Description Usage Arguments Details Value Author(s) See Also Examples
Recode x1
and x2
per the lexical codes
table.
1 |
x1, x2 |
vectors of the same length assuming a discrete number of levels |
codes |
a 2-dimensional matrix indexed by the levels of |
1. If length(x1) != length(x2), complain.
2. if(is.logical(x1)) l1 <- c(FALSE, TRUE) else l1 <- unque(x1); ditto for x2.
3. If(missing(codes)) codes <- outer(unique(x1), unique(x2))
4. if(is.null(dim(codes))) dim(codes) <- c(length(unique(x1)), length(unique(x2)))
5. If is.null(rownames(codes)), set as follows: If nrow(codes) == length(unique(x1)), rownames(codes) <- unique(x1). Else, if nrow(codes) = max(x1), set rownames(codes) <- seq(1, max(x1). Else throw an error. Ditto for colnames, ncol, and x2.
6. codes[x1, x2]
a vector of the same length as x1 and x2.
Spencer Graves
1 2 3 4 5 6 7 8 9 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.