aDataScene-shiny: Shiny bindings for aDataScene

Description Usage Arguments Details See Also Examples

Description

Output and render functions for using aDataScene within Shiny applications.

Usage

1
2
3
aDataSceneOutput(outputId, ..., skipDependencies = FALSE)

renderADataScene(expr, env = parent.frame(), quoted = FALSE)

Arguments

outputId

output variable to read from

...

Attributes, A-Frame components, and/or child elements for output in HTML.

skipDependencies

Option to omit packaged A-Frame JavaScript libraries. See details.

expr

An expression that returns a call to aDataScene

env

The environment in which to evaluate expr.

quoted

Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable.

Details

A-Frame v0.7.1, gg-aframe v0.2.3, and aframe-environment-component v1.0.0 come packaged with shinyaframe. To use different versions, set skipDependencies to TRUE and source the libraries directly (for example with includeScript or tag).

See Also

'gg-aframe' syntax documentation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Simple 3D scatterplot.
# See package vignette for additional asethetics, guides, and legends
if (interactive()) {
  library(dplyr)
  library(shiny)
  library(scales)
  shinyApp(
    ui = fluidPage(
      aDataSceneOutput(
        outputId = "mydatascene",
        # gg-aframe plot syntax
        atags$entity(
          plot = "", position = "0 1.6 -1.38", rotation = "0 45 0",
          atags$entity(
            `layer-point` = "", `mod-oscillate` = "",
            `data-binding__sepal.length`="target: layer-point.x",
            `data-binding__sepal.width`="target: layer-point.y",
            `data-binding__petal.length`="target: layer-point.z",
            # add 4th positional by animating y position between two mappings
            `data-binding__petal.width`="target: mod-oscillate.y",
            `data-binding__species`="target: layer-point.shape"
          )
        )
      )
    ),
    server = function(input, output, session) {
      output$mydatascene <- renderADataScene({
        names(iris) <- tolower(names(iris))
        iris %>%
          # scale positional data
          mutate_if(is.numeric, rescale) %>%
          aDataScene()
      })
    }
  )
}

shinyaframe documentation built on May 2, 2019, 5:08 a.m.