dt_count: Count

Description Usage Arguments Examples

View source: R/count.R

Description

Count the numbers of observations within groups

Usage

1
dt_count(dt_, ..., na.rm = FALSE, wt = NULL)

Arguments

dt_

the data table to uncount

...

groups

na.rm

should any rows with missingness be removed before the count? Default is FALSE.

wt

the wt assigned to the counts (same number of rows as the data)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(data.table)
dt <- data.table(
  x = rnorm(1e5),
  y = runif(1e5),
  grp = sample(1L:3L, 1e5, replace = TRUE),
  wt = runif(1e5, 1, 100)
  )

dt_count(dt, grp)
dt_count(dt, grp, na.rm = TRUE)
dt_count(dt, grp, na.rm = TRUE, wt = wt)

TysonStanley/tidyfast documentation built on Dec. 8, 2019, 9:46 a.m.