filter_count: Count observations dropped from data.table by running expr...

View source: R/sumstats.R

filter_countR Documentation

Count observations dropped from data.table by running expr and save as attribute

Description

Count observations dropped from data.table by running expr and save as attribute

Usage

filter_count(dt, fields, key_name, expr)

Arguments

dt

data.table to transform and 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

key_name

string list key to save the statistics under, in the "log" attribute of the data.table

expr

Value

input data.table after transform from expr

Examples

iris_dt <- as.data.table(iris)
iris_dt <- filter_count(iris_dt, c("*", "Species", "Species-Petal.Width"),
  "setosa-only", { iris_dt[Species == "setosa"] })
attr(iris_dt, "log")


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