mtabulate | R Documentation |
mtabulate
- Similar to tabulate
that works on
multiple vectors.
as_list
- Convert a count matrix to a named list of elements. The
semantic inverse of mtabulate
.
mtabulate(vects)
as_list(mat, nm = rownames(mat))
vects |
A |
mat |
A matrix of counts. |
nm |
A character vector of names to assign to the list. |
mtabulate
- 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
number of columns in data.frame
). If list of vectors is
named these will be the rownames of the dataframe.
as_list
- Returns a list of elements.
Joran Elias and Tyler Rinker <tyler.rinker@gmail.com>.
https://stackoverflow.com/a/9961324/1000343
tabulate
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)
as_list(mtabulate(dat))
t(mtabulate(dat))
as_list(t(mtabulate(dat)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.