【发布时间】:2017-02-10 00:19:48
【问题描述】:
我的项目几乎完成了,我正在尝试对我的应用进行一些美学上的改变,以使其更加用户友好和有吸引力。
想法: 由于我的应用程序需要上传表格才能工作,我认为如果我在屏幕中间放置一个独立的大上传按钮会更好,然后会出现一个导航栏,其中会出现结果、绘图、下载.
这是我尝试过的:
shinyUI(
fileInput("file","Upload the file")
if(!is.null(input$file)) {
navbarPage("My Application",
tabPanel("Data", tableOutput("table")),
tabPanel("Summary", tableOutput("sum")),
tabPanel("Regression", verbatimTextOutput("reg")),
tabPanel("Wavelet Coefficients", htmlOutput("tmod1"),
tableOutput("mod1"),
tableOutput("mod2")),
tabPanel("Wavelet Plot", plotOutput("plot")),
tabPanel("About file", tableOutput("filedf"))
)}
)
错误如下:
ERROR: D:\OneDrive\MODWT App/ui.R:7:1: unexpected 'if'
6:
7: if
^
有什么解决办法吗? :/
我目前的“计划 b”是创建两个应用程序,第一个是上传的应用程序,如果用户上传文件,则 server.R 将调用“原始”应用程序。这甚至可能吗?
如果这个问题看起来很愚蠢,我深表歉意,但我是一个菜鸟编码器,所以我不知道这些限制。
谢谢
【问题讨论】:
-
RStudio为你写了一篇文章:shiny.rstudio.com/articles/dynamic-ui.html
-
输入反应对象在 ui 端不可用。最好让 ui 返回
htmlOutput('AnEntirePage'),然后使用 renderUI 编写 if 语句。
标签: r user-interface shiny