knitr::opts_chunk$set(echo = FALSE)
param <- sort(unique(palmerpenguins::penguins$species))
param_len <- length(param)

Children {.tabset}

Using tabset get all the penguin names in "tabs". Each section should print ok but get the same info.

param_num <- 1
# Define new environment
child_env <- new.env()
child_env$species <- param[param_num]

# knit the document and save the character output to an object
res <- knitr::knit_child(
  "species-child.Rmd",
  envir = child_env,
  quiet = TRUE
)

# Cat the object to make it render in your main document
cat(res, sep = '\n')
param_num <- 2
# Define new environment
child_env <- new.env()
child_env$species <- param[param_num]

# knit the document and save the character output to an object
res <- knitr::knit_child(
  "species-child.Rmd",
  envir = child_env,
  quiet = TRUE
)

# Cat the object to make it render in your main document
cat(res, sep = '\n')


leppott/ContDataSumViz documentation built on Jan. 30, 2024, 10 p.m.