count_by: Count number of observations in a data.table summarized by a...

View source: R/sumstats.R

count_byR Documentation

Count number of observations in a data.table summarized by a certain set of fields

Description

Count number of observations in a data.table summarized by a certain set of fields

Usage

count_by(dt, fields)

Arguments

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

Examples

iris_dt <- as.data.table(iris)
count_by(iris_dt, c("*", "Species", "Species-Petal.Width"))


fcocquemas/hfty.helpers documentation built on Feb. 13, 2023, 7:25 a.m.