-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Hello and thank you for your package.
In this example, what is the correct way to write the condition inside metaRender for a better display with the Show code button.
library(shiny)
library(shinymeta)
library(ggplot2)
ui <- fluidPage(
titlePanel("Old Faithful Geyser Data"),
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30),
radioButtons("column",
"Select column:",
choices = c("eruptions", "waiting"))
),
mainPanel(
outputCodeButton(plotOutput("plot"))
)
)
)
server <- function(input, output) {
output$plot <- metaRender(renderPlot, {
p <- ggplot(faithful, aes_string(..(input$column)))
p <- p + geom_histogram(bins = ..(input$bins))
if (..(input$bins<=30)) {
p <- p + theme_dark()
} else {
p <- p + theme_bw()
}
p
})
}
shinyApp(ui = ui, server = server)Here, the Show code button show :
library(ggplot2)
p <- ggplot(faithful, aes_string("eruptions"))
p <- p + geom_histogram(bins = 30L)
if (TRUE) {
p <- p + theme_dark()
} else {
p <- p + theme_bw()
}
pI would like it to simply display:
library(ggplot2)
p <- ggplot(faithful, aes_string("eruptions"))
p <- p + geom_histogram(bins = 30)
p <- p + theme_dark()
pMany thanks in advance for your support!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels