Search code examples
rservershinydashboardserver-error

RShiny will not output any results to the server. 'Error in server(...) : unused argument (output = list(<environment>, function (x) x))'


My Rshiny app will not our put the correlation plot I want and i am unsure as to why. I am getting this error when I run the code.

Warning: Error in server: unused argument (output = list(<environment>, function (x) x))
[No stack trace available]
Error in server(...) : 
unused argument (output = list(<environment>, function (x) x))

This is the code I am using :

library(shiny)
library(shinydashboard)
combined1 = read.csv("combined.csv", stringsAsFactors=F, na.strings=c(NA,"NA"," NA", "na"))



ui <- dashboardPage(
dashboardHeader(title = "NBA Draft"),
dashboardSidebar(),
dashboardBody(
  box(plotOutput("correlation_plot"), width = 8),
  box(
    selectInput("features", "Features:",
              c("Pts", "Ast", "Trb",
                "WS.48")), width = 4
  )
)
)



server <- function(input, outout){
  outout$correlation_plot <- renderPlot({
    plot(combined1$Pk, combined1[[input$Features]],
         xlab = "Pk", ylab = "Features")
 })

}


shinyApp(ui, server)

I do not know why I am getting this error can someone help me please?


Solution

  • Try this:

    library(shiny)
    library(shinydashboard)
    combined1 = read.csv("combined.csv", stringsAsFactors=F, na.strings=c(NA,"NA"," NA", "na"))
    
    
    
    ui <- dashboardPage(
    dashboardHeader(title = "NBA Draft"),
    dashboardSidebar(),
    dashboardBody(
      box(plotOutput("correlation_plot"), width = 8),
      box(
        selectInput("features", "Features:",
                  c("Pts", "Ast", "Trb",
                    "WS.48")), width = 4
      )
    )
    )
    
    
    
    server <- function(input, output){
      output$correlation_plot <- renderPlot({
        plot(combined1$Pk, combined1[[input$Features]],
             xlab = "Pk", ylab = "Features")
     })
    
    }
    
    
    shinyApp(ui, server)
    

    The variable should be called output not outout