Este es mi código:
library(gapminder) ggplotly(ggplot(gapminder %>% filter(country == "Chile")) + aes(x = year, y = pop) + geom_line())Luego uso la herramienta de acercamiento:
Entonces tengo esta salida:
Mi pregunta es : ¿Cómo puedo acceder/extraer el marco de datos relacionado con esta salida?
Alguna ayuda ?
Supongo que necesitas esto: Podemos hacerlo con crosstalk :
library(DT) library(plotly) library(crosstalk) library(gapminder) options(persistent = FALSE) my_data <- SharedData$new(gapminder %>% filter(country == "Chile")) my_plot <- plot_ly(my_data, x = ~ year, y = ~ pop, type = 'scatter', mode = 'lines') %>% add_markers(alpha = 0.5) %>% highlight(on = "plotly_selected", off = "plotly_deselect", dynamic = TRUE) my_table <- datatable(my_data) bscols(widths = c(6, 4), my_plot, my_table)