library(tidyverse) library(metafor) library(Hmisc) library(ggthemes) windowsFonts(Times=windowsFont("Times New Roman")) # Note. This script contains code that produces the descriptive information in # the article #<##################################################################################> # # INFORMATION ON STUDY LEVEL ---- # #<##################################################################################> #> Number of studies and samples---- #<##################################################################################> studyData %>% summarise(N_samples = n_distinct(studyID), N_papers = n_distinct(paperID)) #> Total sample size---- #<##################################################################################> studyData %>% summarise(total_N = sum(n)) #> Number of countries---- #<##################################################################################> studyData %>% filter(!is.na(country)) %>% summarise(total_N = n_distinct(country)) #> Investigated types of respondents---- #<##################################################################################> #Number of investigated populations studyData %>% select(-n) %>% filter(!is.na(sample_categ)) %>% count(sample_categ, sort=TRUE) #Median sample size in each category studyData %>% filter(!is.na(sample_categ)) %>% group_by(sample_categ) %>% summarise(Median_n = median(n, na.rm=TRUE)) # Number of single-country studies (->multiple-country studies have NA in "country" studyData %>% select(-n) %>% count(is.na(country)) #> Frequencies of countries---- #<##################################################################################> #Note. This figure did not make it in the paper (unfortunately) studyData3 %>% filter(!is.na(country)) %>% select(-n) %>% count(country, sort=TRUE) %>% mutate(country = fct_reorder(country, n)) %>% ggplot(aes(country, n))+ geom_col()+ geom_rangeframe()+ theme_tufte()+ theme(text = element_text(size=15))+ coord_flip()+ labs(y ="Number of studies", x= "Country") # Table of countries and regions (TABLE 2 in the article) country_table <- studyData4 %>% select(-n) %>% filter(!is.na(country)) %>% group_by(cult.clust, country) %>% count() %>% arrange(cult.clust) %>% print(n=100) write.table(country_table,"clipboard",sep="\t",col.names=NA)