-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Minimal example:
library(shinymeta)
input <- list(title = "paste(5, alpha)")
code <- metaExpr(parse(text = input$title))
expandChain(code)
Results in an error
Error: <text>:1:50: unexpected '<'
1: structure(expression(paste(5, alpha)), srcfile = <
^
Example in a shiny app:
library(shiny)
library(ggplot2)
library(shinymeta)
ui <- fluidPage(
textInput("text", "text", "paste(text, alpha)"),
checkboxInput("parse", "Parse axis", FALSE),
plotOutput("plot"),
actionButton("code", "Show Code")
)
server <- function(input, output, session) {
output$plot <- metaRender2(renderPlot, {
xtitle <- if (input$parse) parse(text = input$text) else input$text
metaExpr({
ggplot(mtcars, aes(mpg,wt)) +
geom_point() +
xlab(..(xtitle))
})
})
observeEvent(input$code, {
code <- expandChain(output$plot())
displayCodeModal(code)
})
}
shinyApp(ui, server)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels