Hi guys I have been trying this for weeks but I couldn't manage to get it done. Online resources for R leaflet are not enough too. Really need to get this done.
Please help, thank you so much.
ui.R -->
library(shiny)
library(ggmap)
library(leaflet)
shinyUI(bootstrapPage(
  leafletOutput("map"),
  br(),
  verbatimTextOutput("out")
)
)
server.R -->
library(shiny)
library(ggmap)
library(leaflet)
shinyServer(function(input, output, session) {
output$map <- renderLeaflet({
 p <- input$map_click
 if(is.null(p)){
   leaflet() %>% setView(lng = -43.1729, lat = -22.9068, zoom = 11) %>%
     addTiles(options = providerTileOptions(noWrap = TRUE)) 
 }
 else{
   address <- revgeocode(c(p$lng,p$lat))
   leaflet() %>% setView(lng = p$lng, lat = p$lat, zoom = 16) %>%
   addTiles(options = providerTileOptions(noWrap = TRUE)) %>%
   addCircles(p$lng, p$lat, weight = 1, radius = 100, color =  "black",
                    fillColor = "orange", popup = address, fillOpacity=0.5, opacity=1)
 }
})
output$out <- renderPrint({
validate(need(input$map_click, FALSE))
click <- input$map_click
clat <- click$lat
clng <- click$lng
address <- revgeocode(c(clng,clat))
print(clat)
print(clng)
print(address)
})
})
 
     
    
