r - Removing the X,Y in nearPoints() Output -


i want use functionality of nearpoints() print out summary statistics specific point without printing x, y associated point. have been able use function printing data frame , variations of data frame. there anyway suppress columns customize output? nearpoints comes latest version of shiny 0.12.1 believe may have been introduced little earlier.

i know documentation says this: note these functions appropriate if x , y variables present in data frame, without transformation. if, example, have plot x position calculated column of data, these functions won’t work. in such case, may useful first calculate new column , store in data frame. wanted know if there kind of work around.

here app illustrates problem, note i'm using of libraries in bigger app:

library(shiny) library(ggplot2) library(cairo) library(plyr) library(dplyr) library(shinydashboard) library(grid) library(gridextra) # loads grid library(grdevices) library(ggmap) library(sqldf)  cars <- mtcars ui <- basicpage(   plotoutput("plot1", click = "plot_click"),   datatableoutput("info") )  server <- function(input, output) {   output$plot1 <- renderplot({     ggplot(cars, aes(x=cyl, y=carb)) + geom_point()   })    output$info <- renderdatatable({ summary_cars <- ddply(cars, .(gear, cyl, carb),  function(dd){as.data.frame(cbind(mean_hp = mean(dd$hp),                                     mean_wt = mean(dd$wt))                                     )  })   #this works------------------------------------------------------- #     nearpoints(summary_cars, input$plot_click, threshold = 10,  #                adddist = true)  #removing columns not work ---------  nearpoints(select(summary_cars,-cyl,-carb), input$plot_click, threshold = 10,              adddist = f)   }) }  shinyapp(ui, server) 


Comments