rShiny中的空白ggplot图故障排除

rShiny中的空白ggplot图故障排除,r,ggplot2,shiny,shinydashboard,R,Ggplot2,Shiny,Shinydashboard,当我运行这段代码时,ggplot'ventoutcomes'不会显示,它显示为一个空白图。当我在RStudio中为VentutComes运行单独的代码时,它成功地创建了图形。故障排除的想法?由于患者保密,我无法发布数据集。 多谢各位 库(闪亮) 库(semantic.dashboard) 图书馆(GG2) 图书馆(绘本) 图书馆(DT) ##开发工具::安装\u github(“ropensci/plotly”) ##创建仪表板所需的软件包 setwd(“/Users/k/Desktop/HM

当我运行这段代码时,ggplot'ventoutcomes'不会显示,它显示为一个空白图。当我在RStudio中为VentutComes运行单独的代码时,它成功地创建了图形。故障排除的想法?由于患者保密,我无法发布数据集。 多谢各位

库(闪亮)
库(semantic.dashboard)
图书馆(GG2)
图书馆(绘本)
图书馆(DT)
##开发工具::安装\u github(“ropensci/plotly”)
##创建仪表板所需的软件包
setwd(“/Users/k/Desktop/HMHCOVID”)
##设置工作目录。您也可以在R Studio中的会话…设置工作目录下执行此操作。如果这样做,请删除此行。
图书馆(dplyr)
图书馆(GG2)
图书馆(tidyr)
##加载包

cols我认为你是对的,是什么导致了这个问题,我很确定这是一个环境问题。我的意思是,我看到
是通过脚本中的
read.csv()
分配的,但它“在”应用程序的
服务器
部分之外。这实际上意味着它将在运行时对服务器隐藏

尝试将这些行移动到
服务器中

Figure<-read.csv("Figure.csv",header=TRUE)
Figure_Event<-read.csv("Figure_Event.csv",header=TRUE)

Figure.csv在您的目录中吗?如果你制作了一个只有该绘图的应用程序,它会运行吗?我们无法运行此应用,因为我们没有您的文件夹或文件。你能让它重现吗?这里解释:您能告诉我如何在我的代码中执行它吗?我是新来的RShiny,不知道如何重新排序。感谢您的帮助,请将您的代码直接带到
调用中,如果它不是
调用,则应该在
服务器
用户界面
中。
ui
的东西对我来说似乎很好。现在
ui
之前的所有代码(除了
library
调用)都应该移动到
服务器中。您将看到对答案的一些编辑,以查看我所说的内容。非常感谢所有这些都是有意义的。谢谢你的时间
# library calls
library(...)
library(...)

ui <- dashboardPage(...

    # ui stuff here already

)


server <- shinyserver(function(input,output) {

    # your prep code goes here.  That's EVERYTHING about preparation
    # of your data...load all datasets here or it will not be visible to the app.
    # almost consider this part your console commands to the app that should
    # be there before the program is run (or during).
    # so, any user-defined functions also go here, or reading of files...
    # if you have to add some columns to that data after reading.. .goes here too

    output$ventoutcomes <- renderPlot({...
        })

    output$donors_time <- renderPlot({...
        })