Output and render functions for using langevitour within Shiny applications and interactive Rmd documents.
Usage
langevitourOutput(outputId, width = "100%", height = "600px")
renderLangevitour(expr, env = parent.frame(), quoted = FALSE)
Arguments
- outputId
output variable to read from
- width, height
Must be a valid CSS unit (like
'100%'
,'400px'
,'auto'
) or a number, which will be coerced to a string and have'px'
appended.- expr
An expression that generates a langevitour, usually a block of code ending with a call to
langevitour()
- env
The environment in which to evaluate
expr
.- quoted
Is
expr
a quoted expression (withquote()
)? This is useful if you want to save an expression in a variable.
Examples
library(shiny)
library(palmerpenguins)
completePenguins <- na.omit(penguins[,c(1,3,4,5,6)])
scale <- apply(completePenguins[,-1], 2, sd)*4
ui <- fluidPage(
sliderInput('zoom', 'Zoom', 0, min=-1, max=1, step=0.1),
langevitourOutput('widget')
)
server <- function(input,output) {
output$widget <- renderLangevitour({
langevitour(
completePenguins[,-1],
completePenguins$species,
scale=scale * 10^input$zoom, pointSize=2)
})
}
app <- shinyApp(ui, server)
# Use runApp(app) or runGadget(app) to run app.