[R-sig-Geo] How to objectively subset cities by population

Kent Johnson kent3737 at gmail.com
Thu Jul 27 14:29:43 CEST 2017


>
> Date: Thu, 27 Jul 2017 04:09:53 +0000 (UTC)
> From: "Thiago V. dos Santos" <thi_veloso at yahoo.com.br>
> To: R-sig-geo Mailing List <r-sig-geo at r-project.org>
> Subject: [R-sig-Geo] How to objectively subset cities by population
> Message-ID: <1634627903.292923.1501128593268 at mail.yahoo.com>
> Content-Type: text/plain; charset="UTF-8"
>
> Dear all,
>
> I have temperature records of nearly 1200 locations in southern Brazil.
>
> I am writing a shiny app that will show an interactive map with the
> locations plotted as circles, where the user can click a location to see
> its temperature time series.
>
> However, if I show all the locations in the map, it will look really bad,
> too cramped.
>

Have you considered using leaflet to make an interactive map? This is a
good start:

library(leaflet)
locs <- read.csv("
https://www.dropbox.com/s/ykdd8x1mlc76klt/locations.csv?raw=1")

leaflet(locs) %>% addTiles() %>%
  addCircles(radius=~20*sqrt(Population), label=~as.character(Geocode),
             stroke=FALSE, fillOpacity=0.5)

You can configure popups to show HTML or get Shiny events on click, for
example clicking on a city could display the time series in a separate
panel.

Docs and many examples on the leaflet for R web site:
https://rstudio.github.io/leaflet/

Kent

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list