【发布时间】:2017-08-14 23:06:19
【问题描述】:
问题:
图表不渲染。没有错误。
说明:
即使我没有使用下面的反应值,它应该可以工作,因为它在观察到的事件中。渲染表格效果很好。
其他信息
肯定填充了 AllElements 数据!我把它们打印出来检查。它们是 double 类型的向量。
library(shiny)
library(shinyWidgets)
library(shinythemes)
library(datasets)
shinyApp(
ui = navbarPage(
"Real Time Instruments",
############################# Page 1 #############################
tabPanel("Training",
mainPanel(
actionButton("analyse", "Train Model", width = "100%")
)
############################# Page 2 #############################
),
tabPanel("Results",
tableOutput ( "error"),
plotOutput("predict_plot", inline = TRUE)
)
),
server = function(input, output, session) {
### Analyse the data
analyse <- observeEvent(input$analyse , {
# Run the Analysis
AllElements <- data.frame( x = 1:10 )
# populate the results
populateResults (AllElements)
})
#### Results Page ####
populateResults <- function (allElements) {
# First the error table
output$error <- renderTable(allElements$error_sd, digits = 5) ## <--- THIS WORKS!!!
# Second Plots
# par(mar = rep(2, 4)) # Might be needed
x <- allElements$x
xlab <- allElements$x
y <- allElements$x
ylab <- allElements$x
# Plot Predict Var
output$predict_plot <- renderPlot({plot (x, y)}) # <--- THIS DOESN'T WORK!!!
}
})
}
)
【问题讨论】:
-
请提供一个可重现的例子。错误也可能出现在 UI 中。所以请分享一个应用程序的代码。您也没有描述究竟是什么不起作用。没有剧情吗?是否显示错误消息?
-
@FelixGrossmann 更新。
-
我更新了你的代码。由于缺少括号和一些逗号,它对我不起作用。毕竟它仍然不起作用,因为没有可用的
AnalyseData。 -
@FelixGrossmann 我用虚拟数据改变了它。它现在应该可以工作了