library(dplyr)
library(leaflet)
pokeStops <- read.csv("pokemon.csv")
head(pokeStops)
## cell_id encounter_id spawn_id pokemon_type_id latitude longitude
## 1 0 0 0 21 -0.257622 52.51879
## 2 0 0 0 48 -76.536133 38.69669
## 3 0 0 0 13 -76.537127 38.69688
## 4 0 0 0 13 -76.536043 38.69652
## 5 0 0 0 48 -76.536585 38.69682
## 6 0 0 0 21 -76.535682 38.69672
## despawn_time_ms scan_time_ms
## 1 146903878 146903855
## 2 146901961 146901931
## 3 146901956 146901931
## 4 146901935 146901931
## 5 146901976 146901931
## 6 146901979 146901931
First we select only valuable variables. In this case latitude and longitude. These are needed to determine where Florida is in respect to the world map.
pokeStops <- select(pokeStops, latitude, longitude)
Then boundries are set around the state of Florida. Latitude must be within 27° N and 30° N. Longitude must be within 99° W and 100° W to pinpoint it on the Orlando metropolitan area.
pokeStopsFlorida <- filter(pokeStops, latitude > "27", latitude < "30")
pokeStopsFlorida <- filter(pokeStopsFlorida, longitude > "-100", longitude < "-99")
Due to massive data size, a sample of 50,000 is selected from data.
set.seed(137)
pokeStopsFlorida <- sample_n(pokeStopsFlorida, 50000, replace = TRUE)
head(pokeStopsFlorida)
## latitude longitude
## 695150 28.6266 -81.4000
## 441740 28.5206 -81.4651
## 978684 28.6478 -81.2325
## 817492 28.5378 -81.3508
## 390724 28.6238 -81.2438
## 1025174 28.5414 -81.3720