# sample data
df <- data.frame(
group1 = c(rep("A", 3), rep("B", 3)),
group2 = rep(c("X", "Y", "Z"), 2),
value1 = 1:6,
value2 = letters[1:6]
)
# Here are examples of the output before it is converted to tabset.
# If you want it to actually work, in the .qmd file,
# set `results='asis'` in the chunk options or
# write `#| results: asis` at the beginning of the chunk.
# Basic usage
render_tabset(df, group1, value1)
# Nested tabset, two outputs side by side with a width of 1:1
render_tabset(
df,
c(group1, group2),
c(value1, value2),
layout = "::: {layout-ncol=2}"
)
# Use heading instead of tabset
render_tabset(
df,
c(group1, group2),
value1,
heading_levels = c(2, 3)
)
Run the code above in your browser using DataLab