map_cog {trelliscopejs}R Documentation

Apply a function to each element of a vector and return a vector of cognostics data frames

Description

Apply a function to each element of a vector and return a vector of cognostics data frames

Usage

map_cog(.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


library(dplyr)
library(tidyr)
library(plotly)
ggplot2::mpg %>%
  nest(data = !one_of(c("manufacturer", "class"))) %>%
  mutate(
    cog = map_cog(data, function(x) tibble(mean_hwy = mean(x$hwy))),
    panel = map_plot(data, function(x) {
      plot_ly(data = x, x = ~cty, y = ~hwy,
        type = "scatter", mode = "markers")
    })
  ) %>%
  trelliscope(name = "city_vs_highway_mpg")


[Package trelliscopejs version 0.2.6 Index]