【发布时间】:2017-06-12 12:57:35
【问题描述】:
我正在尝试用 Shiny R 编写一个简单的应用程序。 我想有两个输入(x 和 y)并绘制相对散点图。代码如下
library(shiny)
ui<-fluidPage(
headerPanel('Plot'),
sidebarPanel(
sliderInput(inputId = 'x',label='X', value = 1,min=1,max=3),
sliderInput(inputId = 'y',label='Y', value = 1,min=1,max=3)
),
mainPanel(
plotOutput('plot')
)
)
server<-function(input,output) {
x <- reactive({input$x})
y <- reactive({input$y})
output$plot <- renderPlot({plot(x,y)})
}
shinyApp(ui=ui, server=server)
代码产生错误,
cannot coerce type 'closure' to vector of type 'double'
我该如何纠正这个问题?
非常感谢
【问题讨论】: