File: MMCPSRAnalysis.R

Comment: Create a line graph articles per year
Category: Visualization
Code:
ggplot(ArticlesbyYear, aes(x=Year, y=n, group = 1)) + geom_line(color="orange") + labs(y = "Number of Articles", angle = 45) + theme_minimal(base_size = 12)

Comment: Create a barplot articles per year
Category: Visualization
Code:
ggplot(ArticlesbyYear, aes(x = Year, y = n)) + geom_bar(stat = "identity", color = "steelblue3", fill = "steelblue3") + theme_minimal(base_size = 12) + labs(y = "Articles", angle = 45) + geom_text(aes(label = n), vjust ="center", size=3, hjust = "center", nudge_y = 1)

Comment: Create a barplot articles per journal
Category: Visualization
Code:
ggplot(Journals, aes(x = reorder(Journal, Percent), y = Percent)) + geom_bar(stat = "identity", color = "steelblue3", fill = "steelblue3") + coord_flip() + theme_minimal(base_size = 11) + labs(y = "Percent", x = "Journal") + geom_text(aes(label = Percent), vjust ="center", size=3, hjust = "center", nudge_y = 0.01)

Comment: Create barplot Subfields Percents counts
Category: Visualization
Code:
ggplot(subfield_count, aes(x = reorder(Subfield, Percent) , y = Percent, fill = Subfield)) + geom_bar(stat = "identity") + scale_fill_brewer(palette = "Blues", guide = FALSE) + coord_flip() + theme_minimal(base_size = 13) + labs(y = "Percent of Articles", x = "Subfield") + geom_text(aes(label = Percent), vjust ="center", size=3, hjust = "center", nudge_y =.1) + scale_y_continuous(labels = scales::percent, limits = c(0,1))

Comment: authorlevel count and proportion for all gender identity categories
Category: Data Variable
Code:
gender_author <- author_data %>% subset(!is.na(Gender.apsa)) %>% dplyr::summarize(count = c(sum(male_apsa, na.rm=T), sum(female_apsa, na.rm=T), sum(nonbinary_apsa, na.rm=T))) gender_author <- gender_author %>% mutate(proportion = round(count / sum(count), 2)) %>% mutate(gender = c("male", "female", "nonbinary")) %>% dplyr::select(gender, count, proportion)

Comment: calculate count and proportion of gender author structure
Category: Statistical Modeling
Code:
gender_article_dedup <- gender_article %>% distinct(article_title, single_authored_male, single_authored_female, co_authored_male, co_authored_female, co_authored_mixed) gender_article_count <- data.frame(matrix(NA, nrow = 5, ncol = 3)) colnames(gender_article_count) <- c("Author_Gender", "Frequency", "Percent") gender_article_count$Author_Gender <- c("Single Authored Male", "Single Authored Female", "Co-authored Male", "Co-authored Female", "Co-authored Mixed Gender") gender_article_count$Frequency <- c(sum(gender_article_dedup$single_authored_male, na.rm=T), sum(gender_article_dedup$single_authored_female, na.rm=T), sum(gender_article_dedup$co_authored_male, na.rm=T), sum(gender_article_dedup$co_authored_female, na.rm=T), sum(gender_article_dedup$co_authored_mixed, na.rm=T)) gender_article_count$Percent <- formattable::percent(gender_article_count$Frequency/sum(gender_article_count$Frequency), digits = 1)

Comment: articlelevel authorship structure for race / ethnic identity categories
Category: Data Variable
Code:
race_ethnicity_article <- race_ethnicity_article %>% group_by(article_title) %>% mutate(white_authors = ifelse(mean(white) == 1, 1, 0), black_authors = ifelse(mean(black) == 1, 1, 0), east_asian_authors = ifelse(mean(east_asian) == 1, 1, 0), south_asian_authors = ifelse(mean(south_asian) == 1, 1, 0), latino_authors = ifelse(mean(latino) == 1, 1, 0), mena_authors = ifelse(mean(mena) == 1, 1, 0), native_authors = ifelse(mean(native) == 1, 1, 0), pacific_authors = ifelse(mean(pacific) == 1, 1, 0), other_authors = ifelse(mean(other) == 1, 1, 0), mixed_authors = ifelse(mean(white) < 1 & n() > 1, 1, 0))

Comment: count of articles that generated data using experimental techniques (includes articles that use both, percentage calculated using total empirical articles)
Category: Data Variable
Code:
GenerateData[2,2] <- sum(MMCPSR_emp$EHPdata) GenerateData[2,3] <- sum(MMCPSR_emp$EHPdata)/nrow(MMCPSR_emp)

Comment: Number (%) of articles drawing on data collected via Survey (alone + in combo. w/other techniques) Raw Count/percent alone
Category: Data Variable
Code:
SurveySoloCount <- sum(MMCPSR_emp$`Ethnography / participant observation` ==0 & MMCPSR_emp$`Interviews/focus groups` == 0 & MMCPSR_emp$Survey == 1 & MMCPSR_emp$EHPdata == 0 & MMCPSR_emp$gendataNHP == 0 & MMCPSR_emp$`Employed data/information from pre-existing primary or secondary sources`==0) SurveySoloCount formattable::percent(SurveySoloCount/nrow(MMCPSR_emp), digits = 1)

Comment: Number (%) of articles using Field experiments (alone + in combo. w/other techniques) Count/percent alone
Category: Data Variable
Code:
FieldExpSoloCount <- sum(MMCPSR_emp$`Survey experiment` ==0 & MMCPSR_emp$Field == 1 & MMCPSR_emp$Lab == 0 & MMCPSR_emp$OHPdata == 0 & MMCPSR_emp$gendataNHP == 0 & MMCPSR_emp$`Employed data/information from pre-existing primary or secondary sources`==0) FieldExpSoloCount formattable::percent(FieldExpSoloCount/nrow(MMCPSR_emp), digits = 1)

Comment: Number (%) of articles using data generated through interaction with Dom gov
Category: Data Variable
Code:
sum(MMCPSR_emp$`EHP - Domestic government` == 1 | MMCPSR_emp$`OHP - Domestic government`==1) formattable::percent(sum(MMCPSR_emp$`EHP - Domestic government` == 1 | MMCPSR_emp$`OHP - Domestic government`==1) /nrow(MMCPSR_emp), digits = 1)

Comment: Number (%) of articles using data generated through interaction with Media
Category: Data Variable
Code:
sum(MMCPSR_emp$`EHP - Media` == 1 | MMCPSR_emp$`OHP - Media`==1) formattable::percent(sum(MMCPSR_emp$`EHP - Media` == 1 | MMCPSR_emp$`OHP - Media`==1)/nrow(MMCPSR_emp), digits = 1)

Comment: probit and marginal effects experimental data vs time
Category: Statistical Modeling
Code:
out.1.probit <-glm(EHPdata~Year, data = MMCPSR_emp, family = binomial(link = "probit")) summary(out.1.probit) probitmfx(out.1.probit, data = MMCPSR_emp)

Comment: create correlation matrix author gender vs methods categories
Category: Data Variable
Code:
MethodGender_cor <- rcorr(as.matrix(MethodGender_sub))

Comment: DV Formal modeling only OLS Modeling only vs time
Category: Statistical Modeling
Code:
out.12 <- lm(MMCPSR_emp$ModelingOnly ~ MMCPSR_emp$Year) summary(out.12) out.15$coefficients[2]

Comment: Conclusion Policy Recommendations count and percent of all articles
Category: Data Variable
Code:
sum(MMCPSR_Data$`Policy Recommendation`) formattable::percent(sum(MMCPSR_Data$`Policy Recommendation`)/nrow(MMCPSR_Data), digits = 1)

Comment: DV time OLS policy recommendations vs time
Category: Data Variable
Code:
out.21 <- lm(MMCPSR_emp$`Policy Recommendation`~MMCPSR_emp$Year) summary(out.21) out.21$coefficients[2] out.21b <- lm(MMCPSR_emp$`Policy Recommendation`~as.factor(MMCPSR_emp$Year)) summary(out.21b) plot_coefs(out.21b) plot_coefs(lm(MMCPSR_emp$`Policy Recommendation`~ 0 + as.factor(MMCPSR_emp$Year)))