Learn R Programming

COVID19 (version 0.2.1)

gapply: Apply a function to each group

Description

Wrapper for group_map from package dplyr. Can be used to iterate on grouped tibbles.

Usage

gapply(x, f)

Arguments

x

a grouped tibble.

f

a function to apply to each group. It should have at least 2 formal arguments: (1) the group data and (2) the group key.

Value

List of results from calling f on each group.

See Also

group_map

Examples

Run this code
# NOT RUN {
# plot by country
x <- world('country')
f <- function(x, group) {
  plot(x$confirmed~x$date, main = group)
}
gapply(x, f)

# }

Run the code above in your browser using DataLab