asRow | R Documentation |
The asRow
function arranges objects in a row in the display;
the getWidgetId
function extracts the HTML element ID
from an HTML widget.
asRow(..., last = NA, height = NULL, colsize = 1)
getWidgetId(widget)
... |
Either a single |
last |
If not |
height |
An optional height for the resulting row. This is normally specified in pixels, but will be rescaled as necessary to fit the display. |
colsize |
A vector of relative widths for the columns in the row. |
widget |
A single HTML widget from which to extract the HTML element ID. |
Using asRow
requires that the manipulateWidget
package is installed.
asRow
produces a "combineWidgets"
object which
is a single column whose last element is another "combineWidgets"
object which is a single row.
If n
objects are given as input and last
is given a value
less than n
, the first n - last
objects will be displayed
in a column above the row containing the last
objects.
asRow
returns a single "combineWidgets"
object suitable for display or nesting
within a more complicated display.
getWidgetId
returns a character string containing the
HTML element ID of the widget.
Duncan Murdoch
pipe for the %>%
operator.
if (requireNamespace("manipulateWidget", quietly = TRUE) &&
require("crosstalk", quietly = TRUE)) {
sd <- SharedData$new(mtcars)
ids <- plot3d(sd$origData(), col = mtcars$cyl, type = "s")
# Copy the key and group from existing shared data
rglsd <- rglShared(ids["data"], key = sd$key(), group = sd$groupName())
w <- rglwidget(shared = rglsd) %>%
asRow("Mouse mode: ", rglMouse(getWidgetId(.)),
"Subset: ", filter_checkbox("cylinderselector",
"Cylinders", sd, ~ cyl, inline = TRUE),
last = 4, colsize = c(1,2,1,2), height = 60)
if (interactive() || in_pkgdown_example())
w
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.