automagic_tabs: Automatic Generation of Tabs

Description Usage Arguments Details Value See Also Examples

View source: R/automagic_tabs.R

Description

It allows to automatically generate the code necessary to group multiple Rmarkdown chunks into tabs. Concatenating all the chunks into a string that can be later knitted and rendered.

Usage

1
2
3
4
5
6
7
8
9
automagic_tabs(
  input_data,
  panel_name,
  .output,
  ...,
  tabset_title = "",
  tabset_props = ".tabset-fade .tabset-pills",
  is_output_distill = TRUE
)

Arguments

input_data

Ungrouped tibble with at least 2 columns, one for the title of the tabs and another with the output to be displayed.

panel_name

string with the name of the ID column.

.output

string with the name of the column of the output.

...

additional parameters that correspond to all those available in rmarkdown chunks (fig.align, fig.width, ...).

tabset_title

string title of the .tabset

tabset_props

string defining .tabset properties. Only works with is_output_distill = F

is_output_distill

boolean. is output a distill article.

Details

given a tibble, which must contain an "ID" column (representing the title of the tabs) and another column that stores the output to be generated (plot, text, code, ...), a string is automatically generated which can be later rendered in a Rmarkdown document.

Value

concatenated string of all automatically generated chunks.

See Also

sknifedatar website

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(dplyr)
library(sknifedatar)
library(ggplot2)

dataset <- iris %>% 
  group_by(Species) %>% 
  tidyr::nest() %>% 
  mutate(
    .plot = purrr::map(data, ~ ggplot(.x, aes(x = Sepal.Length, y = Petal.Length)) + geom_point())
  ) %>% 
  ungroup()

automagic_tabs(input_data = dataset, panel_name = "Species", .output = ".plot", fig.align='center')

unlink("figure", recursive = TRUE)

sknifedatar documentation built on June 1, 2021, 9:08 a.m.