Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

asRow

Convenience functions for RGL HTML layouts


Description

The asRow function arranges objects in a row in the display; the getWidgetId function extracts the HTML element ID from an HTML widget.

Usage

asRow(..., last = NA, height = NULL, colsize = 1)
getWidgetId(widget)

Arguments

...

Either a single "combineWidgets" object produced by asRow or a %>% pipe of RGL objects, or several objects intended for rearrangement.

last

If not NA, the number of objects from ... that are to be arranged in a row. Earlier ones will remain in a column.

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.

Details

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.

Value

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.

Author(s)

Duncan Murdoch

See Also

pipe for the %>% operator.

Examples

library(crosstalk)
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

rgl

3D Visualization Using OpenGL

v0.106.8
GPL
Authors
Duncan Murdoch [aut, cre], Daniel Adler [aut], Oleg Nenadic [ctb], Simon Urbanek [ctb], Ming Chen [ctb], Albrecht Gebhardt [ctb], Ben Bolker [ctb], Gabor Csardi [ctb], Adam Strzelecki [ctb], Alexander Senger [ctb], The R Core Team [ctb, cph], Dirk Eddelbuettel [ctb], The authors of Shiny [cph], The authors of knitr [cph], Jeroen Ooms [ctb], Yohann Demont [ctb], Joshua Ulrich [ctb], Xavier Fernandez i Marin [ctb], George Helffrich [ctb], Ivan Krylov [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.