Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(rtweet)
- library(dplyr)
- files <- list.files()
- files <- files[grep(".json", files)]
- getPoints <- function(file){
- parse_stream(file) %>%
- lat_lng("bbox_coords") %>% # keep bounding box coords
- filter(is_retweet == FALSE & !is.na(lat)) %>% # keep posts and point lat/longs
- select(status_id, created_at, screen_name, text, is_retweet, lat, lng) # whatever columns to select
- }
- df <- purrr::map_df(files, getPoints)
- ## plot state boundaries
- par(mar = c(0, 0, 0, 0))
- maps::map("state", lwd = .25)
- ## plot lat and lng points onto state map
- with(df, points(lng, lat, pch = 20, cex = .75, col = rgb(0, .3, .7, .75)))
Add Comment
Please, Sign In to add comment