[R-sig-Geo] A leaflet question
Erin Hodgess
er|nm@hodge@@ @end|ng |rom gm@||@com
Wed Jun 1 16:14:49 CEST 2022
Thank you for your kind response.
Here is my code:
library(tigris)
library(leaflet)
library(sf)
#Getting the data
tarrant <- tracts(state="TX",county="Tarrant",cb=TRUE)
tarrant_sp <- as(tarrant,"Spatial")
#Set up ui
ui <- fluidPage(
leafletOutput("plot"),
tableOutput("data")
)
#Set up server
server <- function(input, output, session) {
#Draw map
output$plot <- renderLeaflet({
leaflet(tarrant_sp) %>% addTiles() %>%
addPolygons(label=~TRACTCE)
})
#allegedly grab market clicks
output$data <- renderTable({
nearPoints(tarrant_sp, input$plot_marker_click)
print(input$plot_marker_click)
})
}
shinyApp(ui,server)
I would like to get the values from the click and make calculations based
on the tracts selected. However, nothing is appearing in the
input$plot_marker_click.
Any suggestions much appreciated.
Sincerely,
Erin
Erin Hodgess, PhD
mailto: erinm.hodgess using gmail.com
On Wed, Jun 1, 2022 at 9:03 AM Ben Tupper <btupper using bigelow.org> wrote:
> Hi Erin,
>
> This is a great place to ask questions - especially if you provide a
> reproducible example.
>
> Cheers,
> Ben
>
> On Wed, Jun 1, 2022 at 8:24 AM Erin Hodgess <erinm.hodgess using gmail.com>
> wrote:
>
>> Hello everyone;
>>
>> Can I ask a leaflet question here, please, or is that a topic for RStudio
>> Community?
>>
>> Thanks,
>> Erin
>> --
>> Erin Hodgess, PhD
>> mailto: erinm.hodgess using gmail.com
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo using r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>
> --
> Ben Tupper (he/him)
> Bigelow Laboratory for Ocean Science
> East Boothbay, Maine
> http://www.bigelow.org/
> https://eco.bigelow.org
>
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list