Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

n..html

Number of observations in each group


Description

Helper function that can be used to find counts by group.

Can be used inside summarize.(), mutate.(), & filter.()

Usage

n.()

Examples

test_df <- data.table(
  x = 1:3,
  y = 4:6,
  z = c("a","a","b")
 )

test_df %>%
  summarize.(count = n.(), .by = z)

# The dplyr version `n()` also works
test_df %>%
  summarize.(count = n(), .by = z)

tidytable

Tidy Interface to 'data.table'

v0.6.1
MIT + file LICENSE
Authors
Mark Fairbanks [aut, cre], Abdessabour Moutik [ctb], Matt Carlson [ctb], Ivan Leung [ctb], Ross Kennedy [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.