## install.packages(dplyr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
This is an R Markdown Notebook. It illustrates how we can create a notebook with geodata with R.
We will use the “leaflet”library for mapping locations.
The locations were downloaded from the (Bahar´s website)(https://github.com/bahar/WorldCityLocations/blob/master/World_Cities_Location_table.csv).
##install.packages("leaflet")
library(leaflet)
cities <- read.csv(file ="ciudades.txt",header=FALSE, sep =";")
names(cities) <- c("id", "country", "city", "latitude", "longitude", "altitude")
tail(cities)
leaflet(cities) %>%
addCircles(lng=~longitude, lat=~latitude)
mapa <- leaflet(cities) %>%
addTiles() %>%
addMarkers(lng = ~longitude, lat = ~latitude, popup = ~city)
mapa