Description Usage Arguments Value Examples
Retrieve independent R code as text
1 | get_code(server, ..., envir = parent.frame())
|
server |
the server function to pull code from |
... |
outputs to shake tree upon (or keep all code if no outputs are listed) |
envir |
the environment in which to evaluate server arguments |
a string of code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Not run:
library(shiny)
ui <- fluidPage(
selectInput('x', 'x axis', choices = names(mtcars)),
selectInput('y', 'y axis', choices = names(mtcars)),
plotOutput('plot'),
verbatimTextOutput('code')
)
srv <- function(input, output, session) {
output$plot <- renderPlot({
plot(x = mtcars[[input$x]],
y = mtcars[[input$y]])
})
output$code <- renderText({
get_code(srv, 'plot')
})
}
shinyApp(ui, srv)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.