Learn R Programming

poorman (version 0.2.0)

n: The number of observations in the current group

Description

This function can be used within the context of summarise(), mutate() and filter().

Usage

n()

Arguments

Value

An integer.

Examples

Run this code
# NOT RUN {
mt_gears <- mtcars %>% group_by(gear)
mt_gears %>% mutate(n = n())
mt_gears %>% filter(n() < 10)
mt_gears %>% summarise(n = n())

# }

Run the code above in your browser using DataLab