Shiny error while using nearPoints in renderPlotly click event
问题 I would like to fetch nearPoints using the data from a click event. I have found the below snippet from the Shiny webpage and it works fine as expected. output$plot <- renderPlot({ d <- data() plot(d$speed, d$dist) }) output$plot_clickedpoints <- renderPrint({ # For base graphics, we need to specify columns, though for ggplot2, # it's usually not necessary. res <- nearPoints(data(), input$plot_click, "speed", "dist") if (nrow(res) == 0) return() res }) I tried to mimic the above the approach