n: Compute the number of ranges in each group.

Description Usage Value Examples

View source: R/ranges-eval.R

Description

This function should only be used within summarise(), mutate() and filter().

Usage

1
n()

Value

n() will only be evaluated inside a function call, where it returns an integer.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ir <- as_iranges(
                 data.frame(start = 1:10,
                            width = 5,
                            name = c(rep("a", 5), rep("b", 3), rep("c", 2))
                            )
                )
by_names <- group_by(ir, name)
summarise(by_names, n = n())
mutate(by_names, n = n())
filter(by_names, n() >= 3)

plyranges documentation built on Nov. 8, 2020, 7:36 p.m.