【发布时间】:2014-08-05 09:37:31
【问题描述】:
我最近开始使用 R-Shiny,但遇到了一个简单的问题,因此我被卡住了。
所以,我正在尝试构建一个反应式折线图,用户可以在其中定义数据库中的 2 个变量。
我已经能够获取下拉列表的变量列表,但我无法使用选定的值来绘制折线图。
参考代码:
library(shiny)
shinyUI(fluidPage(
# Application title
titlePanel("ARIMAX Forecasting Tool"),
sidebarLayout(
sidebarPanel(
...
mainPanel(
tabsetPanel(type = "tabs",
tabPanel("Plot", plotOutput("plot")),
tabPanel("Summary")
)
)
)
))
以及部分服务器代码
shinyServer(function(input, output) {
output$plot <- renderPlot({
inFile <- input$file1
if (is.null(inFile))
return(NULL)
content1=read.csv(inFile$datapath, header=input$header, sep=input$sep
)
h=input$x
k=input$ts
plot(content1$k,content1$h,type="l")
})
})
我已经跳过了编写渲染 UI 以让用户选择的部分 variables.x 和 ts 是用户为折线图选择的变量。
我在主面板区域出现错误:
需要有限的 xlim 值
【问题讨论】:
标签: r shiny linechart shiny-server