qdapTools (version 1.3.3)

mtabulate: Tabulate Frequency Counts for Multiple Vectors

Description

Similar to tabulate that works on multiple vectors.

Usage

mtabulate(vects)

Arguments

vects

A vector, list, or data.frame of named/unnamed vectors.

Value

Returns a data.frame with columns equal to number of unique elements and the number of rows equal to the the original length of the vector, list, or data.frame (length equals ncols in data.frame). If list of vectors is named these will be the rownames of the dataframe.

References

http://stackoverflow.com/a/9961324/1000343

See Also

tabulate, counts2list

Examples

Run this code
# NOT RUN {
mtabulate(list(w=letters[1:10], x=letters[1:5], z=letters))
mtabulate(list(mtcars$cyl[1:10]))

## Dummy coding
mtabulate(mtcars$cyl[1:10])
mtabulate(CO2[, "Plant"])

dat <- data.frame(matrix(sample(c("A", "B"), 30, TRUE), ncol=3))
mtabulate(dat)
t(mtabulate(dat))
counts2list(mtabulate(dat))
# }

Run the code above in your browser using DataLab