R: Tabulate Frequency Counts for Multiple Vectors

mtabulate {qdapTools} | R Documentation

## 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.

### Author(s)

Joran Elias and Tyler Rinker <tyler.rinker@gmail.com>.

### References

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

### See Also

`tabulate`, `counts2list`

### Examples

    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))

[Package qdapTools version 1.3.3 Index]