Learn R Programming

mosaic (version 1.9.1)

cross: Factor cross products

Description

Construct a product of factors.

Usage

cross(..., sep = ":", drop.unused.levels = FALSE)

Value

a factor

Arguments

...

factors to be crossed.

sep

separator between levels

drop.unused.levels

should levels that do not appear in cross product be dropped?

Examples

Run this code
x <- letters[1:3]
y <- c(1,2,1,1,3,1,3)
cross(x, y)
cross(x, y, drop.unused.levels=TRUE)

Run the code above in your browser using DataLab