count_by | R Documentation |
Count number of observations in a data.table summarized by a certain set of fields
count_by(dt, fields)
dt |
data.table to summarize |
fields |
string or vector of strings, sets of fields to summarize the observations by. Use "-" between column names to summarize by multiple fields. Use a single "*" to return the unconditional number of rows of the data.table |
iris_dt <- as.data.table(iris) count_by(iris_dt, c("*", "Species", "Species-Petal.Width"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.