SHARE
TWEET

Untitled

a guest Feb 17th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. library("ggplot2")
  2. library("scales")
  3. library("devtools")
  4. install_github("rladies/meetupr", ref = "topic_id")
  5. library("meetupr")  #Requires topic_id branch...
  6. api_key = "API_KEY"  #Use your own meetup.com API key...
  7.  
  8. meetups <- find_groups(topic_id = 1513883, api_key = api_key)  #all groups tagged with "R-Ladies" topic id
  9. meetups <- meetups[-nrow(meetups), ]  #remove Joburg-R-Users-Group
  10. tc <- find_groups(text = "r ladies twin cities", api_key = api_key) #add Twin Cities
  11. tp <- find_groups(text = "r ladies taipei", api_key = api_key)  #add Taipei
  12. meetups <- rbind(meetups, tc, tp)
  13. meetups[nrow(meetups), "created"] <- as.Date("2014-08-01")  #Fix Taipei date
  14.  
  15. meetups$Date <- as.POSIXct(meetups$created)
  16. meetups$counts <- rep(1, nrow(meetups))
  17.  
  18.  
  19. p <- ggplot(meetups, aes(Date, ..count..)) +
  20.   geom_histogram() +
  21.   theme_bw(base_size = 14) + xlab(NULL) +
  22.   scale_x_datetime(breaks = date_breaks("3 months"),
  23.                    labels = date_format("%Y-%b"),
  24.                    limits = c(as.POSIXct("2012-01-01"),
  25.                               as.POSIXct("2019-03-01")) ) +
  26.   geom_vline(xintercept = as.POSIXct("2016-07-01"), col = "purple", size = 2) +
  27.   annotate("text", x = as.POSIXct("2015-03-01"), y = 20, label = "Creation of R-Ladies Global Team/Org \n(useR! 2016)",
  28.            colour = "purple", size = 5) +
  29.   annotate("text", x = as.POSIXct("2012-10-01"), y = 3, label = "San Francisco", colour = "purple", size = 4) +
  30.   annotate("text", x = as.POSIXct("2016-01-31"), y = 3, label = "London", colour = "purple", size = 4) +
  31.   annotate("text", x = as.POSIXct("2015-04-01"), y = 3, label = "Twin Cities", colour = "purple", size = 4) +
  32.   annotate("text", x = as.POSIXct("2014-08-01"), y = 3, label = "Taipei", colour = "purple", size = 4) +
  33.   theme(axis.text.x = element_text(angle = 45, hjust = 1))
  34. p
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top