Last data update: 2014.03.03

R: The number of observations in the current group.
nR Documentation

The number of observations in the current group.

Description

This function is implemented special for each data source and can only be used from within summarise, mutate and filter

Usage

n()

Examples

if (require("nycflights13")) {
carriers <- group_by(flights, carrier)
summarise(carriers, n())
mutate(carriers, n = n())
filter(carriers, n() < 100)
}

Results