rsc_cols | R Documentation |
This helper function makes it easy to put HTML elements side by side. It can be called directly from the console but is especially designed to work in an R Markdown document. Note that this is ripped directly from https://github.com/rstudio/crosstalk without the additional bootstrap dependency (since it is already expected in connectwidgets)
rsc_cols(..., widths = NA, device = c("xs", "sm", "md", "lg"))
... |
|
widths |
The number of columns that should be assigned to each of the
|
device |
The class of device which is targeted by these widths; with smaller screen sizes the layout will collapse to a one-column, top-to-bottom display instead. xs: never collapse, sm: collapse below 768px, md: 992px, lg: 1200px. |
A browsable
HTML element.
library(htmltools)
# If width is unspecified, equal widths will be used
rsc_cols(
div(style = css(width="100%", height="400px", background_color="red")),
div(style = css(width="100%", height="400px", background_color="blue"))
)
# Use NA to absorb remaining width
rsc_cols(widths = c(2, NA, NA),
div(style = css(width="100%", height="400px", background_color="red")),
div(style = css(width="100%", height="400px", background_color="blue")),
div(style = css(width="100%", height="400px", background_color="green"))
)
# Recycling widths
rsc_cols(widths = c(2, 4),
div(style = css(width="100%", height="400px", background_color="red")),
div(style = css(width="100%", height="400px", background_color="blue")),
div(style = css(width="100%", height="400px", background_color="red")),
div(style = css(width="100%", height="400px", background_color="blue"))
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.