-
Notifications
You must be signed in to change notification settings - Fork 0
/
rladies_meetups_v1.Rmd
1324 lines (942 loc) · 50.3 KB
/
rladies_meetups_v1.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "R-Ladies Meetups"
author: "Augustina Ragwitz"
date: "January 21, 2018"
output:
html_document:
toc: true
params:
meetup_api_key: !r Sys.getenv("API_KEY_MEETUP_RLADIES")
archive_folder: !r Sys.Date()
output_folder: "latest"
rds_folder: "rds"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(dplyr)
library(ggplot2)
library(ggthemes)
library(httr)
library(jsonlite)
library(lubridate)
library(maps)
library(purrr)
library(readr)
library(reshape2)
library(scales)
library(stringr)
library(tidyr)
```
# Overview
The purpose of this Exploratory Data Analysis is to provide an overview of what data are available from the Meetup API and to start thinking about how to use these data to answer questions we have about R-Ladies Meetups with a focus on "Health" metrics.
In addition, this notebook seeks to explore different Meetup API workflows in order to improve the MeetupR library. R-Ladies has developed a package called MeetupR to streamline Meetup analysis. While this notebook calls the Meetup API directly to document API calls and parameters, then results should be compared to the MeetupR implementation. If there are possible improvements then patches will be proposed!
Additionally this work can be integrated into the R-Ladies meetup dashboard that shows the latest Meetup stats (useful for conference presentations and other status reports).
## Repo Link
[https://github.com/rladies-pdx/meetup-analysis]
# Data Collection
This section contains API calls made to the Meetup API along with parameters. Some of the API calls experience throttling at high volumes and need to be improved. This made the workflow a bit counterintuitive.
## Meetup API Setup
```{r globals, warning=FALSE}
dir.create(file.path(params$output_folder))
dir.create(file.path(params$rds_folder))
dir.create(file.path(params$archive_folder))
get_meetups <- function (url, query) {
req <- GET(url, query=query)
print(paste(req$url))
json <- content(req, as = "text")
things <- fromJSON(json, flatten=TRUE)
return(things)
}
```
## Meetup Groups
Identifying Meetup groups should be straightforward because R-Ladies exists as a Meetup topic. Unfortunately not every group is using this topic. This uses the "find_groups" function from the Meetup API.
```{r find_groups}
get_rladies_groups <- function (folder) {
groups_url <- "https://api.meetup.com/find/groups"
groups_query_params <- list(
key=params$meetup_api_key,
sign=TRUE,
page=200,
radius="global")
# by topic
meetup_groups_topic <- get_meetups(groups_url, append(groups_query_params, c(topic_id=1513883, order="members")))
# by text + category
meetup_groups_text <- get_meetups(groups_url, append(groups_query_params, c(text="r-ladies", category=34)))
meetup_groups_aggr <- bind_rows(meetup_groups_topic, meetup_groups_text %>% anti_join(meetup_groups_topic, by="id"))
meetup_groups <- meetup_groups_aggr %>% filter(str_detect(name, "[Rr]([ -]?)[Ll]adies"))
meetup_groups <- meetup_groups %>%
mutate(events_url = paste("https://api.meetup.com/", urlname, "/events", sep="")) %>%
select(-meta_category.category_ids) # remove lists
write_csv(meetup_groups, paste(folder, "rladies_meetup_groups.csv", sep="/"),
na = "")
write_csv(meetup_groups_topic %>% select(-meta_category.category_ids),
paste(folder, "rladies_meetup_groups_topic.csv", sep="/"),
na = "")
write_csv(meetup_groups_text %>% select(-meta_category.category_ids),
paste(folder, "rladies_meetup_groups_text.csv", sep="/"),
na = "")
return(meetup_groups)
}
```
I created an account and subscribed it to the found groups. This checks that it is subscribed to all current groups. A future version of this should attempt to join via the Meetup API (depends on join questions).
```{r self_groups}
get_self_groups <- function (folder) {
groups_url <- "https://api.meetup.com/self/groups"
groups_query_params <- list(
key=params$meetup_api_key,
sign=TRUE,
page=200,
fields="approved")
self_groups <- get_meetups(groups_url, groups_query_params)
self_groups <- self_groups %>%
mutate(events_url = paste("https://api.meetup.com/", urlname, "/events", sep="")) %>%
select(-meta_category.category_ids) # remove lists
write_csv(self_groups, paste(folder, "rladies_self_groups.csv", sep="/"),
na = "")
return(self_groups)
}
```
## Group Members
Names and other common identifying information about members has been removed. We are only interested in identifying unique members across groups and events, not who they are.
```{r group_members, eval=FALSE}
get_rladies_members <- function (meetup_groups, folder) {
members_query_params <- list(
key=params$meetup_api_key,
sign=TRUE,
page=200,
fields=paste("memberships", "topics", "gender", sep=",") # these can only go with individual profile calls
)
dir.create(file.path(paste(folder, "rladies_members", sep="/")))
meetup_members <- data_frame()
for (n in 1:nrow(meetup_groups)) {
members_url <- str_replace(meetup_groups[n,]["events_url"], "events", "members")
num_members <- as.numeric(meetup_groups[n,]["members"])
for (i in 1:ceiling(num_members/200)) {
print(paste("Trying url:", members_url))
members <- get_meetups(members_url, append(members_query_params, c(offset=i)))
if(length(members)== 0) {
next()
}
# remove identifying info
members <- members %>%
select(-name)
members$group_profile.answers <- NULL
meetup_members <- bind_rows(meetup_members, members)
write_csv(meetup_members,
paste0(folder, "/rladies_members/_meetup_members_", n, ".csv"),
na = "")
}
}
# remove identifying info
meetup_members <- meetup_members %>%
select(-group_profile.intro, -bio, -email, -group_profile.title)
write_csv(meetup_members, paste(folder, "rladies_meetup_members.csv", sep="/"),
na = "")
}
```
## Upcoming Events
### Calendar
Depends on querying account being a member of the meetups.
```{r self_calendar}
get_rladies_calendar <- function (folder) {
calendar_url <- "https://api.meetup.com/self/calendar"
events_query_params <- list(
key=params$meetup_api_key,
sign=TRUE,
page=200,
order="time",
radius="global")
get_events <- function (url, query) {
req <- GET(url, query=query)
print(paste(req$url))
json <- content(req, as = "text")
events <- fromJSON(json, flatten=TRUE)
return(events)
}
meetup_events_calendar <- get_events(calendar_url, events_query_params)
write_csv(meetup_events_calendar, paste(folder, "rladies_meetup_calendar.csv", sep="/"),
na = "")
return(meetup_events_calendar)
}
```
### Per Group Query
Per group query - note that this gets throttled so here it is limited to groups the querying account does not have membership to.
```{r group_events_future}
get_rladies_future <- function (meetup_groups, folder) {
future_events_query_params <- list(
key=params$meetup_api_key,
sign=TRUE,
page=200,
status="upcoming",
fields=paste("comment_count", "photo_album", sep=", ")
)
dir.create(file.path(paste(folder, "rladies_meetup_events", sep="/")))
meetup_events_future <- data_frame()
for (n in 1:nrow(meetup_groups)) {
events_url <- meetup_groups[n,]["events_url"]
if(is.na(events_url)) {
print(paste("No events url for", n, meetup_groups[n,]["name"]))
next()
}
print(paste("Trying url:", events_url$events_url))
meetups <- get_meetups(events_url$events_url, future_events_query_params)
if(length(meetups)== 0) {
next()
}
meetups <- meetups %>% mutate(photo_album.photo_sample=NA)
meetup_events_future <- bind_rows(meetup_events_future, meetups)
write_csv(meetup_events_future,
paste0(folder, "/rladies_meetup_events/_meetup_events_future_", n, ".csv"),
na = "")
}
write_csv(meetup_events_future, paste(folder, "rladies_meetup_events_future.csv", sep="/"),
na = "")
return(meetup_events_future)
}
```
### Upcoming Events Endpoint
Meetup provides an upcoming_events endpoint that is convenient but may not be comprehensive. Let's use it and compare our results to the group by group approach above.
```{r upcoming_events}
get_rladies_upcoming <- function (folder) {
find_upcoming_url <- "https://api.meetup.com/find/upcoming_events"
# change to get upcoming meetups for all meetups in the list
events_query_params <- list(
key=params$meetup_api_key,
sign=TRUE,
page=200,
order="time",
radius="global")
get_group_events <- function (url, query) {
req <- GET(url, query=query)
print(paste(req$url))
json <- content(req, as = "text")
groups <- fromJSON(json, flatten=TRUE)
return(groups$events)
}
# I tried "topic" but no R-Ladies results were returned, so this field doesn't apply
meetup_events_text <- get_group_events(find_upcoming_url, append(events_query_params, c(text="rladies")))
# just in case anything slipped in there
meetup_events_upcoming <- meetup_events_text %>% filter(str_detect(group.name, "[Rr](-?)[Ll]adies"))
write_csv(meetup_events_upcoming, paste(folder, "rladies_meetup_upcoming_events.csv", sep="/"),
na = "")
return(meetup_events_upcoming)
}
```
## Past Events
Get all past events for all groups. This call is expensive and gets throttled.
```{r group_events_past, eval=FALSE, message=FALSE, warning=FALSE}
# Run this 2nd when updating archives
# TODO this currently throttles out and has to be manipulated manually to run
get_rladies_past_all <- function (folder) {}
folder=params$archive_folder
meetup_groups <- read_csv(paste(folder, "rladies_meetup_groups.csv", sep="/"))
past_events_query_params <- list(
key=params$meetup_api_key,
sign=TRUE,
page=200,
status="past",
fields=paste("comment_count", "photo_album", sep=", ")
)
dir.create(file.path(paste(folder, "rladies_meetup_events", sep="/")))
meetup_events_past <- data_frame()
for (n in 73:nrow(meetup_groups)) {
events_url <- meetup_groups[n,]["events_url"]
print(paste("Trying url:", events_url$events_url))
meetups <- get_meetups(events_url$events_url, past_events_query_params)
if(length(meetups)== 0) {
next()
}
meetups <- meetups %>% mutate(photo_album.photo_sample=NA)
meetup_events_past <- bind_rows(meetup_events_past, meetups)
write_csv(meetup_events_past, paste0(folder, "/rladies_meetup_events/_meetup_events_past_", n, ".csv"),
na = "")
}
write_csv(meetup_events_past, paste(folder,"rladies_meetup_events_past.csv", sep="/"),
na = "")
# copy entire archive folder to latest, don't try to manage individual file updates
system2("rm", args = c("-r", params$output_folder))
system2("cp", args = c("-R", paste(params$archive_folder), paste(params$output_folder)))
```
Combine the previous past events pull for a group with the previous upcoming events pull where the event has occurred in the past. If all previous upcoming events occurred in the past, then we'll need to pull past events for the group depending on the time interval.
Check this against the updated group list to find any groups that need all events pulled. Only pull all events for those groups.
```{r group_events_past_v2}
get_rladies_past <- function() {
# TODO
}
```
## Past Events RSVPs
Get a list of member id's that RSVP'ed to past meetups.
```{r past_member_rsvps, eval=FALSE, message=FALSE, warning=FALSE}
# Run this 3rd when updating archives
base_url <- "https://api.meetup.com"
folder=params$archive_folder
meetup_events_past <- read_csv(paste(params$output_folder,"rladies_meetup_events_past.csv", sep="/"))
member_rsvps_query_params <- list(
key=params$meetup_api_key,
sign=TRUE,
response="yes"
)
dir.create(file.path(paste(folder, "rladies_member_rsvps", sep="/")))
meetup_member_rsvps <- data_frame()
for (n in 458:nrow(meetup_events_past)) {
rsvps_url <- paste(base_url, meetup_events_past[n,]["group.urlname"], "events", meetup_events_past[n,]["id"], "rsvps",
sep="/")
print(paste("Trying url:", rsvps_url))
rsvps <- get_meetups(rsvps_url, member_rsvps_query_params)
if(length(rsvps)== 0) {
next()
}
if("errors" %in% names(rsvps)) {
print(paste(n, ":", rsvps$errors))
break()
}
rsvps <- rsvps %>%
select(member.id, created, updated, member.event_context.host, event.yes_rsvp_count, event.id, group.name) %>%
mutate(member_rsvps = n())
meetup_member_rsvps <- bind_rows(meetup_member_rsvps, rsvps)
write_csv(meetup_member_rsvps, paste0(folder, "/rladies_member_rsvps/_meetup_member_rsvps_", n, ".csv"),
na = "")
}
write_csv(meetup_member_rsvps, paste(folder,"rladies_member_rsvps.csv", sep="/"),
na = "")
# copy entire archive folder to latest, don't try to manage individual file updates
system2("rm", args = c("-r", params$output_folder))
system2("cp", args = c("-R", paste(params$archive_folder), paste(params$output_folder)))
```
## Get Latest
Create a new archive folder and get the latest data.
```{r get_latest_data, eval=FALSE}
# Run this first when updating archives
dir.create(file.path(params$archive_folder))
# TODO add try/catch for throttling
meetup_groups <- get_rladies_groups(params$archive_folder)
self_groups <- get_self_groups(params$archive_folder)
pending_groups <- meetup_groups %>%
anti_join(self_groups, by="id")
get_rladies_upcoming(params$archive_folder)
meetup_events_calendar <- get_rladies_calendar(params$archive_folder)
if (nrow(pending_groups) > 0) {
meetup_events_future <- get_rladies_future(pending_groups, params$archive_folder)
} else {
meetup_events_future <- data_frame()
}
meetup_events_current <- bind_rows(meetup_events_future, meetup_events_calendar)
write_csv(meetup_events_current, paste(params$archive_folder,"rladies_meetup_events_current.csv", sep="/"),
na = "")
# Adding this for reference, need to check that it still works
meetup_members <- get_rladies_members(meetup_groups, params$archive_folder)
```
```{r copy_archive_to_latest, eval=FALSE}
system2("rm", args = c("-r", params$output_folder))
system2("cp", args = c("-R", paste(params$archive_folder), paste(params$output_folder)))
```
# Meetup Groups
```{r meetup_groups, message=FALSE}
meetup_groups <- read_csv(paste(params$output_folder, "rladies_meetup_groups.csv", sep="/"))
```
## Group Membership Check
Check group membership for the retrieval account.
```{r check_self_groups, message=FALSE}
self_groups <- read_csv(paste(params$output_folder, "rladies_self_groups.csv", sep="/"))
pending_groups <- meetup_groups %>%
anti_join(self_groups, by="id") %>%
select(id, name, join_mode, link, events_url) %>%
arrange(join_mode)
```
All Pending Groups:
Groups the retrieval account does not belong to. Data from these groups will not be in this report. If this report has any groups listed here, have the retrieval account join them and then rerun the analysis above.
```{r pending_groups}
pending_groups
```
Pending Groups Not Requiring Approval:
These are groups the retrieval account can join and have immediate access to. The ones requiring approval take longer because a person has to approve the membership.
```{r pending_groups_approval}
pending_groups %>% filter(join_mode != "approval")
```
## Topic R-Ladies
Groups that use the official "r-ladies" Meetup topic. These will show up on this page - [https://www.meetup.com/topics/r-ladies/]
```{r find_group_by_topic, message=FALSE}
meetup_groups_topic <- read_csv(paste(params$output_folder, "rladies_meetup_groups_topic.csv", sep="/"))
```
## Text search "R-Ladies"
A text search for "rladies" did not return any results. Including the tech category id (34) excludes extra results.
```{r find_group_by_text, message=FALSE}
meetup_groups_text <- read_csv(paste(params$output_folder, "rladies_meetup_groups_text.csv", sep="/"))
```
## R-Ladies Missing Topic
Groups that matched a text search for R-Ladies but are not using the Meetup topic.
```{r groups_missing_topic}
# group + organizer to contact
meetups_missing_topic <- meetup_groups_text %>% anti_join(meetup_groups_topic, by="id")
meetups_missing_topic %>% filter(str_detect(name, "[Rr]([ -]?)[Ll]adies")) %>%
arrange(-members) %>%
select(name, localized_location, organizer.name, members, created)
```
# Meetup Members
Membership numbers only show the current totals. To track membership over time we need to see when members joined the group. Additionally, we are interested in discovering repeat RSVPs as well as common group membership.
## Historical Membership
Proposed Improvement: Determine number of members over time based on when members joined the group. This will be done in a Membership focused version of this analysis.
# Meetup Activity
Identifying which groups are regularly scheduling Meetups will help us to see who is the most active. Groups with gaps in Meetup activity or with no events should be highlighted so we can reach out to their organizers.
## Past Events
```{r read_past_events, message=FALSE}
meetup_events_past <- read_csv(paste(params$output_folder,"rladies_meetup_events_past.csv", sep="/"))
meetup_groups <- read_csv(paste(params$output_folder, "rladies_meetup_groups.csv", sep="/"))
meetup_events_past_merge <- meetup_events_past %>%
inner_join(meetup_groups %>%
select(urlname, city, country, state, members, timezone),
by=c("group.urlname"="urlname")) %>%
separate(timezone, c("region"), extra="drop", fill="left")
meetup_events_past_merge <- meetup_events_past_merge %>%
mutate(
group.created=as.POSIXct(group.created/1000, tz="UTC", origin="1970-01-01"),
created=as.POSIXct(created/1000, tz="UTC", origin="1970-01-01"))
saveRDS(meetup_events_past_merge, paste(params$rds_folder, "meetup_events_past_merge.Rds", sep="/"))
```
## Event Frequency
How many events has each meetup had?
```{r past_events_freq}
past_events_freq <- meetup_events_past_merge %>%
group_by(group.name) %>%
summarise(num_events=n(),
lat=first(group.lat), lon=first(group.lon),
location=first(group.localized_location),
country=first(country),
state=first(state),
city=first(city),
members=first(members),
region=first(region)) %>%
mutate(num_events_log = round(log(num_events))) %>%
group_by(num_events_log) %>%
mutate(events_min_max = ifelse(min(num_events) == max(num_events),
paste(min(num_events)),
paste(min(num_events), "-", max(num_events))))
```
```{r past_events_freq_hist, fig.height=8, fig.width=10}
ggplot(past_events_freq, aes(x=reorder(location, num_events), y=num_events)) +
geom_bar(stat="identity", aes(fill=region)) +
theme_few() +
coord_flip() +
labs(x="Chapter", y="Events", title="Number of Events")
```
## Event Frequency Density
How many meetups are having how many events? What is the most common event frequency amongst Meetup groups? What's "normal"? This is only looking at number of events and does not consider other factors like Meetup age. The majority of groups have had between 1 and 4 events.
This uses a log of the total number of events to group into buckets, then the min/max of the values found in each bucket are reported on the X-axis. I'm sure there's a magical R function to do this instead of the way I'm doing it.
```{r}
ggplot(past_events_freq, aes(x=reorder(events_min_max, num_events_log))) +
geom_density() +
theme_few() +
xlab("Events per Meetup (Log)")
```
## Meetup Age by First Event
What is the "age" of meetups based on their first event? Rather than considering the date the Meetup was created, looking at when the first event happened may be a more realistic indicator of age.
```{r meetup_first_event, message=FALSE, warning=FALSE}
past_event_age <- meetup_events_past_merge %>%
group_by(group.name) %>%
summarise(first_meetup = as_datetime(min(local_date, na.rm=FALSE)),
location=first(group.localized_location),
region=first(region),
group.created=first(group.created)) %>%
mutate(first_meetup_age=difftime(Sys.Date(), first_meetup, unit="days"),
location=reorder(location, first_meetup_age))
```
```{r meetup_first_event_plot, fig.width=10, fig.height=8}
ggplot(past_event_age, aes(x=location, y=first_meetup_age)) +
geom_bar(stat="identity", aes(fill=region)) +
theme_few() +
coord_flip() +
scale_y_continuous(breaks = pretty(past_event_age$first_meetup_age, n = 10)) +
labs(x="Chapter", y="Days Since First Meetup", title="Meetup Age by First Event")
```
## First Meetup vs Created
How big of a difference do we see between the first event and the created by date? If the creation date was used to determine age, how might the ranking of meetup groups by age be affected?
```{r first_meetup_vs_created, message=FALSE, warning=FALSE, fig.width=10, fig.height=8}
created_vs_first <- past_event_age %>%
mutate(
group_age = difftime(Sys.Date(), group.created, units="days"),
created_interval=difftime(first_meetup, group.created, units="days"),
location=reorder(location, -created_interval))
ggplot(created_vs_first, aes(x=location, y=created_interval)) +
geom_bar(stat="identity", aes(fill=region)) +
theme_few() +
coord_flip() +
labs(x="Chapter", y="Days", title="Days Between Creation and First Event")
```
```{r, message=FALSE, warning=FALSE, fig.height=8, fig.width=10}
created_vs_first_melt <- created_vs_first %>%
mutate(location=reorder(location,group_age)) %>%
select(location, group_age, created_interval) %>%
melt()
ggplot(created_vs_first_melt, aes(x=location, y=value)) +
geom_bar(stat="identity", position="dodge", aes(fill=variable)) +
theme_few() +
coord_flip() +
labs(x="Chapter", y="Days", fill= "Days Type", title="Meetup Age vs Days Between Creation and First Meetup")
```
## No First Meetup
A proposed metric would be to identify what groups have yet to have a first meetup. This could be an anti-join between the group list and the event summary.
## Event Interval
How much time passes between the Meetup events? Are some groups regularly meeting every month? What is the typical time between Meetup groups? This metric needs to be explored further.
This plot is hard to read and I don't think this is the best metric to use as is. The idea here was just to show the overall distribution for all of the groups. A different visualization might be better here. Something to explore further might be looking for consistency in time between events and determining what's "normal" for each individual meetup.
```{r event_interval}
event_intervals <- meetup_events_past_merge %>%
group_by(group.name) %>%
arrange(local_date) %>%
mutate(
prev_event = lag(local_date),
days_between = difftime(local_date, prev_event, unit="days")
) %>%
select(group.name, group.localized_location, region, days_between, local_date, prev_event, id)
```
```{r event_interval_plot, message=FALSE, warning=FALSE, fig.width=10, fig.height=10}
event_intervals_curr <- event_intervals %>% filter(local_date > as_datetime("2016-01-01"))
ggplot(event_intervals_curr, aes(x=local_date, y=days_between)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location), show.legend = FALSE)+
theme_few() +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
scale_y_continuous() +
scale_x_date(date_breaks = "1 month") +
facet_wrap(~ region, scales="free") +
labs(x="Event Month", y="Days Since Last Meetup", fill= "Region", title="Days Between Meetups")
```
```{r event_interval_plot_by_region, message=FALSE, warning=FALSE, fig.width=10, fig.height=8}
ggplot(event_intervals_curr %>% filter(region %in% c("US", "Canada")), aes(x=local_date, y=days_between)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location)) +
theme_few() +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
guides(fill=guide_legend(ncol = 1)) +
scale_y_continuous() +
scale_x_date(date_breaks = "1 month") +
labs(x="Month", y="Days Since Last Meetup", fill= "Region", title="Days Between Meetups (North America)")
ggplot(event_intervals_curr %>% filter(region=="Europe"), aes(x=local_date, y=days_between)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location)) +
theme_few() +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
guides(fill=guide_legend(ncol = 1)) +
scale_y_continuous() +
scale_x_date(date_breaks = "1 month") +
labs(x="Month", y="Days Since Last Meetup", fill= "Region", title="Days Between Meetups (Europe)")
ggplot(event_intervals_curr %>% filter(region %in% c("Australia", "Asia", "Africa")), aes(x=local_date, y=days_between)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location)) +
theme_few() +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
scale_y_continuous() +
scale_x_date(date_breaks = "1 month") +
labs(x="Month", y="Days Since Last Meetup", fill= "Region", title="Days Between Meetups (APAC)")
ggplot(event_intervals_curr %>% filter(region=="America"), aes(x=local_date, y=days_between)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location)) +
theme_few() +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
scale_y_continuous() +
scale_x_date(date_breaks = "1 month") +
labs(x="Month", y="Days Since Last Meetup", fill= "Region", title="Days Between Meetups (Latin America)")
```
This looks for the most common event intervals to compare across groups. A density plot might also be useful here to see what intervals are the most common.
```{r event_interval_summary}
event_intervals_summary <- event_intervals_curr %>%
group_by(group.name) %>%
mutate(num_meetups = n()) %>%
filter(!is.na(days_between)) %>%
mutate(days_between_log = round(log(as.numeric(days_between + 1)))) %>%
group_by(days_between_log) %>%
mutate(days_between_min_max = ifelse(min(days_between) == max(days_between),
paste(min(days_between)),
paste(min(days_between), "-", max(days_between)))) %>%
group_by(group.name, days_between_log) %>%
summarise(
days_between_freq = n(),
days_between_min = min(days_between),
days_between_max = max(days_between),
num_meetups = first(num_meetups),
days_between_min_max = first(days_between_min_max),
location = first(group.localized_location),
region = first(region)
)
# TODO freq % -> # meetups in days between bucket / total # meetups
# which.max just returns one row, we want all max rows
event_intervals_summary_top <- event_intervals_summary %>%
group_by(group.name) %>%
slice(which(days_between_freq == max(days_between_freq)))
```
```{r event_interval_summary_plot, fig.height=8, fig.width=10}
event_intervals_summary_top <- event_intervals_summary_top %>%
mutate(days_between_min_max=)
ggplot(event_intervals_summary_top, aes(x=reorder(location, num_meetups), y=reorder(days_between_min_max, days_between_log))) +
geom_bar(stat="identity", position="dodge", aes(fill=region)) +
theme_few() +
coord_flip() +
labs(x="Chapter", y="Days", fill= "Region", title="Days Between Meetups - Most Frequent")
```
# Event Cadence
Related to intervals above. In a given time period, how many meetups does each group have? This is mentioned as a proposed metric below and will be part of a future version of this analysis focused on Events.
# Upcoming Meetups
### Upcoming Events Endpoint vs Fetch per Group
The Upcoming Events endpoint appears to be pretty limited in what it returns. These are groups that are missing from the upcoming events data that was retrieved.
```{r upcoming_vs_future, message=FALSE, warning=FALSE}
meetup_events_upcoming <- read_csv(paste(params$output_folder, "rladies_meetup_upcoming_events.csv", sep="/"))
meetup_events_upcoming <- meetup_events_upcoming %>% mutate(id=id)
meetup_events_current <- read_csv(paste(params$output_folder, "rladies_meetup_events_current.csv", sep="/"))
meetup_events_missing <- meetup_events_current %>% anti_join(meetup_events_upcoming, by="id") %>% unique()
meetup_events_missing %>% arrange(local_date) %>% select(group.name, name, local_date)
```
### Missing Groups
The upcoming_events endpoint could be useful as a check for any groups that were missed via the find groups endpoint. This should be zero, but if anything shows up, it could be worth double checking the group!
```{r missing_groups, message=FALSE}
meetup_events_current <- read_csv(paste(params$output_folder, "rladies_meetup_events_current.csv", sep="/"))
meetup_events_upcoming <- read_csv(paste(params$output_folder, "rladies_meetup_upcoming_events.csv", sep="/"))
meetup_events_current <- meetup_events_current %>% mutate(id=as.character(id))
meetup_events_upcoming <- meetup_events_upcoming %>% mutate(id=as.character(id))
not_in_groups <- meetup_events_upcoming %>% anti_join(meetup_events_current, by="id")
# check group id
missing_groups <- meetup_events_upcoming %>% anti_join(meetup_groups, by=c("group.name"="name"))
missing_groups
```
# Membership
How can we best determine Meetup membership? While counting members may not be the best estimate, considering RSVP's may shed more light on this. Not everyone who RSVP's actually shows up, so we may want to look at RSVP trends to determine a better way to adjust the count.
## RSVP Frequency
How many people RSVP to the meetups?
```{r, past_rsvp_summary}
past_rsvps <- meetup_events_past_merge %>%
group_by(group.name) %>%
mutate(
yes_rsvp_pct = round(yes_rsvp_count/members, 2), # Problem: based on current membership, not membership at the time
yes_rsvp_log = round(log(yes_rsvp_count)),
event_month=month(created, label=TRUE),
event_ym=format(created, "%Y-%m-01") # TODO use lubridate
) %>%
group_by(group.name, yes_rsvp_log) %>%
mutate(yes_rsvp_log_freq = n()) %>%
ungroup() %>%
group_by(group.name, yes_rsvp_pct) %>%
mutate(yes_rsvp_pct_freq = n())
past_rsvp_summary <- past_rsvps %>%
group_by(event_ym, group.name) %>%
summarise(yes_rsvp_sum_grp=sum(yes_rsvp_count), region=first(region))
```
```{r past_rsvp_summary_plot, fig.width=12, fig.height=6}
ggplot(past_rsvp_summary, aes(x=event_ym, y=yes_rsvp_sum_grp)) +
geom_bar(stat="identity", aes(fill=region)) +
theme_few() +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
labs(x="Event Month", y="Yes RSVPs", fill="Region", title="Past Yes RSVPs by Region")
ggsave("png/rsvp_by_region.png")
```
How many yes RSVP's does each group typically get? This plot is ordered by number of members reported by Meetup to show how misleading number of members can be when considering who actually engaged with the group.
```{r past_rsvp_freq, message=FALSE}
past_rsvp_freq <- past_rsvps %>%
group_by(group.name) %>%
summarize(num_events=n(),
rsvps_sum = sum(yes_rsvp_count),
rsvps_med = round(median(yes_rsvp_count)),
rsvps_min = min(yes_rsvp_count),
rsvps_max = max(yes_rsvp_count),
rsvps_mode = yes_rsvp_log[which.max(yes_rsvp_log_freq)],
rsvps_pct_mode = yes_rsvp_pct[which.max(yes_rsvp_pct_freq)],
lat=first(group.lat), lon=first(group.lon),
location=first(group.localized_location),
country=first(country),
state=first(state),
city=first(city),
members=first(members),
region=first(region)) %>%
mutate(location=reorder(location, -members))
```
```{r past_rsvp_freq_plot, fig.width=10, fig.height=8}
ggplot(past_rsvp_freq, aes(x=location, y=rsvps_pct_mode)) +
geom_bar(stat="identity", aes(fill=region)) +
theme_few() +
scale_y_continuous(labels=percent) +
coord_flip() +
labs(x="Chapter", y="% of Unique Members who RSVPed at least once", fill="Region",
title="Yes RSVPs - Most Frequent, Ordered by # Members")
```
## RSVPs per Meetup
Overall RSVPS per Meetup per group (over time)
```{r rsvps_per_meetup, fig.width=12, fig.height=6}
past_rsvps_month_curr <- past_rsvps %>%
filter(str_detect(local_date, "2017")) # TODO can we use lubridate here?
ggplot(past_rsvps_month_curr, aes(x=event_month, y=yes_rsvp_count)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location), show.legend = FALSE) +
theme_few() +
facet_wrap(~ region, scales="free") +
labs(x="Event Month", y="# Yes RSVPs", fill="Region", title="Yes RSVPs by Chapter")
ggsave("png/rsvp_by_chapter.png")
```
```{r rsvps_per_meetup_by_region, fig.width=10, fig.height=8}
ggplot(past_rsvps_month_curr %>% filter(region %in% c("US", "Canada")), aes(x=event_month, y=yes_rsvp_count)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location)) +
theme_few() +
labs(x="Event Month", y="# Yes RSVPs", fill="Chapter", title="Yes RSVPs by Chapter (North America)") +
guides(fill=guide_legend(ncol = 1))
ggplot(past_rsvps_month_curr %>% filter(region=="Europe"), aes(x=event_month, y=yes_rsvp_count)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location)) +
theme_few() +
labs(x="Event Month", y="# Yes RSVPs", fill="Chapter", title="Yes RSVPs by Chapter (Europe)")
ggplot(past_rsvps_month_curr %>% filter(region %in% c("Australia", "Asia", "Africa")), aes(x=event_month, y=yes_rsvp_count)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location)) +
theme_few() +
labs(x="Event Month", y="# Yes RSVPs", fill="Chapter", title="Yes RSVPs by Chapter (APAC)")
ggplot(past_rsvps_month_curr %>% filter(region=="America"), aes(x=event_month, y=yes_rsvp_count)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location)) +
theme_few() +
labs(x="Event Month", y="# Yes RSVPs", fill="Chapter", title="Yes RSVPs by Chapter (Latin America)")
```
Percent RSVPs - depends on total membership which only reports an overall total, not the total at the time of the event.
```{r rsvps_pct_per_meetup, fig.width=12, fig.height=6}
ggplot(past_rsvps_month_curr, aes(x=event_month, y=yes_rsvp_pct)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location), show.legend = FALSE) +
facet_wrap(~ region) +
theme_few() +
labs(x="Event Month", y="% Members RSVPed", fill="Chapter", title="% Members RSVPs by Chapter")
ggsave("png/rsvp_pct_members.png")
```
```{r rsvps_pct_per_meetup_by_region, fig.width=10, fig.height=8}
ggplot(past_rsvps_month_curr %>% filter(region %in% c("US", "Canada")), aes(x=event_month, y=yes_rsvp_pct)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location)) +
scale_y_continuous(labels=percent) +
theme_few() +
guides(fill=guide_legend(ncol=1)) +
labs(x="Event Month", y="% of Current Members RSVPed Yes", fill="Region", title="Yes RSVPs by Chapter (North America)")
ggplot(past_rsvps_month_curr %>% filter(region=="Europe"), aes(x=event_month, y=yes_rsvp_pct)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location)) +
scale_y_continuous(labels=percent) +
theme_few() +
labs(x="Event Month", y="% of Current Members RSVPed Yes", fill="Region", title="Yes RSVPs by Chapter (Europe)")
ggplot(past_rsvps_month_curr %>% filter(region %in% c("Australia", "Asia", "Africa")), aes(x=event_month, y=yes_rsvp_pct)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location)) +
scale_y_continuous(labels=percent) +
theme_few() +
labs(x="Event Month", y="% of Current Members RSVPed Yes", fill="Region", title="Yes RSVPs by Chapter (APAC)")
ggplot(past_rsvps_month_curr %>% filter(region=="America"), aes(x=event_month, y=yes_rsvp_pct)) +
geom_bar(stat="identity", position="dodge", aes(fill=group.localized_location)) +
scale_y_continuous(labels=percent) +
theme_few() +
labs(x="Event Month", y="% of Current Members RSVPed Yes", fill="Region", title="Yes RSVPs by Chapter (Latin America)")