从 CSV 构建基本图 R 闪亮数据

Building basic plot R Shiny data from CSV

Ok Im an R newbie but this shouldnt be this hard Im trying to run a very basic scattered plot in Shiny like I did in R Studio based on some CSV data. When I run the Shiny app I get a blank space for the graph. The graph works totally fine when i run it in R studio. If anyone has any ideal please let me know

library(shiny)
library(shinydashboard)
library(plyr)
# Simple header -----------------------------------------------------------
header <- dashboardHeader(title="Basic")

sidebar <- dashboardSidebar()

body <- dashboardBody(
  fluidPage(
    fluidRow(
      box(plotOutput("Scores", height = 250)),
    )
  )
)

ui <- dashboardPage(header, sidebar, body, skin="black")

# Setup Shiny app back-end components -------------------------------------

server <- function(input, output) { 

  output$scatteredplot <- renderPlot ({
    data <- read.csv("Scores.csv")
    averageTime<-ddply(data, .(IP, OS), summarize, time=mean(time), score=mean(score), status=mean(status))
    plot(averageTime$RemediationTime,averageTime$score,xlab="time", ylab="score")
  })


  }

# Render Shiny app --------------------------------------------------------

shinyApp(ui, server)

错误在下面两行的组合

box(plotOutput("Scores", height = 250)),

您在这里寻找一个名为 Scores 的图,但是

output$scatteredplot <- renderPlot ({

你只定义了一个名为 scatteredplot 的图

所以将最后一行替换为

output$Scores <- renderPlot ({

其实

里面还有一个多余的逗号
 box(plotOutput("Scores", height = 250)),  

但这可能是为了生成一个最小的可重现示例