Shiny interacting with graphics

I am trying to create an interactive plot for airquality in shiny but I keep getting the error "Warning: Error in writeImpl: Text to be written must be a length-one character vector
[No stack trace available]"

I'm not sure what this means does anyone have any solutions?

I have included my code below,

Thanks in advance!

library(shinydashboard)
library(datasets)
ui<-dashboardPage(
    dashboardHeader(title= airquality),
    dashboardSidebar(collapsed = TRUE),
    dashboardBody(
        fluidRow(
            plotOutput("airquality",
                       click="single_Click"
                       ),
                     box((verbatimTextOutput("coords")),width=12)
        )
    )
)

server<-function(input,output){
    output$airquality<-renderPlot({
        plot(x=airquality$Ozone, y=airquality$Day,
             xlab="Ozone",ylab="Day",
             pch=as.character(airquality$Temp))
    })
    output$coords<-renderprint({
        
        nearPoints(airquality, input$single_click,
                   xvar="Ozone", yvar="Day",
                   threshold = 20)
    })
}
shinyApp(ui=ui, server=server)

you need to quote airquality so that the text is used, otherwise an error due to using a dataframe as a title will happen

dashboardHeader(title="Air Quality"),

p should be capitalised.

output$coords<-renderPrint({

The capitalisation of single_(c/C)lick is inconsistent, need to choose one or the other

Thank you so much for your help! You were exactly right and it worked perfectly after I made the corrections!

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.