【发布时间】:2019-10-31 10:46:19
【问题描述】:
我想用下一步按钮显示三个不同的散点图。任务是猜测每个图中相关性的强度。问题是我只能看到相同的情节。我尝试使用下一个按钮来查看下一个情节。
library(shiny)
# 3 different dataframes/data for scatter plots
data1 <- data.frame(a <- c(20,30,35,45,50,60,80),
b <- c(60,70,72,77,82,88,90))
data2 <- data.frame(a <- c(20,30,35,45,50,60,80),
b <- c(60,70,68,77,82,88,70))
data3 <- data.frame(a <- c(35,40,38,50,52,51,30),
b <- c(60,70,72,64,82,88,90))
ui = fluidPage(
sidebarPanel(
sliderInput
(inputId = "fit", label = "estimated correlation",
min = 0, max = 1, value = 0),
actionButton("newplot", "next")),
mainPanel(plotOutput("plot")))
server = function(input, output) {
output$plot <- renderPlot({
input$newplot
plot(data1)
plot(data2)
plot(data3)
})
}
shinyApp(ui = ui, server = server)
【问题讨论】: