Loading packages
Each member of the group should have installed and loaded the leaflet package
Each member of your group finds latitude & longitude:
Go to https://www.google.com/maps, click twice on the map (or right-click, then select “What’s here?”) until the grey marker and box appears (as in below) that lists your latitude and longitude:
Copy the Y, X location (e.g. 54.768244, -1.577359) and paste it into the table
##Gathering group data in a dataframe
name<-c("Monica","Andrew Baldwin","Greta","James Bond","Charles Darwin","Queen Elizabeth","J.K. Rowling","Another famous person")
location<-c("Durham","Newcastle","Derby","Durham","Durham","Durham","Durham","Durham")
latitude <- c(42.944753, 54.977768, 52.9258854, 54.775022, 54.77627, 54.779059, 54.777864,54.769299)
longitude <- c(-78.841205, -1.615672, -1.5232818, -1.585936, -1.5836173, -1.579716, -1.581218, -1.568980)
groupdf <- data.frame(name, location, latitude, longitude)
groupdf
## name location latitude longitude
## 1 Monica Durham 42.94475 -78.841205
## 2 Andrew Baldwin Newcastle 54.97777 -1.615672
## 3 Greta Derby 52.92589 -1.523282
## 4 James Bond Durham 54.77502 -1.585936
## 5 Charles Darwin Durham 54.77627 -1.583617
## 6 Queen Elizabeth Durham 54.77906 -1.579716
## 7 J.K. Rowling Durham 54.77786 -1.581218
## 8 Another famous person Durham 54.76930 -1.568980
Looking at examples
Use RStudio to create a map with leaflet that plots all of the locations in your dataframe as points.
Here is the guide to Leaflet in R: https://rstudio.github.io/leaflet
Use the example of Quakes here https://rstudio.github.io/leaflet/markers.html
Here is the example of quakes from the link above:
Now modify it with your own code
leaflet(data = groupdf) %>%
addTiles() %>%
addMarkers(~longitude, ~latitude, popup = ~as.character(name))
If you are uncomfortable using pipes, this is the same as
You may want to modify the aesthetics of your map
Stay Tuned
Please visit the development page of the prettydoc
package for latest updates and news. Comments, bug reports and pull requests are always welcome.