| create_tabs | R Documentation |
This function generates a tabbed HTML interface for displaying multiple R objects such as 'ggplot2' plots and data frames. Each tab can include custom arguments for rendering (e.g., image width or table formatting).
create_tabs(...)
... |
Named arguments where each name defines a tab label. Each argument can be either:
|
Supported object types:
'ggplot' objects — rendered as base64-encoded images using 'save_base64()'
'data.frame' or 'tibble' — rendered using 'kable_html()'
Additional arguments passed inside the list are used by the relevant rendering function.
A 'htmltools::tag' object representing the full tab interface. Can be printed in R Markdown documents or displayed interactively in RStudio Viewer.
## Not run:
library(ggplot2)
# Simple plot and table
p <- ggplot(cars) + geom_point(aes(speed, dist))
df <- head(cars)
# Basic usage
create_tabs(
plot = p,
table = df
)
# With custom rendering arguments
create_tabs(
plot = list(object = p, width = 4),
table = list(object = df, digits = 2)
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.