Learn R Programming

tidytable (version 0.6.2)

n.: 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.()

Arguments

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab