cogs: Cogs Wrapper Function

Description Usage Arguments Details Examples

View source: R/tidy.R

Description

Cogs Wrapper Function

Usage

1
cogs(.x, .f, ...)

Arguments

.x

a list or atomic vector (see map for details)

.f

a function, formula, or atomic vector (see map for details)

...

additional arguments passed on to .f (see map for details)

Details

See map

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(dplyr)
library(tidyr)
library(plotly)
ggplot2::mpg %>%
  nest(data = !one_of(c("manufacturer", "class"))) %>%
  mutate(
    additional_cogs = map_cog(data, function(x) {
      tibble(
        max_city_mpg = cog(max(x$cty), desc = "Max city mpg"),
        min_city_mpg = cog(min(x$cty), desc = "Min city mpg"))
    }),
    panel = map_plot(data, function(x) {
      plot_ly(data = x, x = ~cty, y = ~hwy,
        type = "scatter", mode = "markers")
    })
  ) %>%
  trelliscope(name = "city_vs_highway_mpg", nrow = 1, ncol = 2)

trelliscopejs documentation built on Feb. 1, 2021, 9:05 a.m.