knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
# load packages library(metadat) library(tidyverse) library(metadatanalysis)
Questions to answer about the data contained in metadat::
md <- get_metadata() # distribution of k, number of studies plotdat <- md %>% dplyr::filter(class != "phylo") %>% mutate(k = map(raw_dat, get_k), row_n = map_int(raw_dat, nrow)) %>% dplyr::filter(k != "no study id") %>% mutate(k = as.integer(k)) # plot k plotdat %>% ggplot(aes(x = k)) + geom_histogram(alpha = 0.7) + labs(title = stringr::str_wrap("Distribution of number of studies in datasets in metadat::", 80), caption = paste(nrow(plotdat), "out of", nrow(md), "datasets."))
Ridgeplotdat1<-inner_join(meta_of_dat,plotdat) library(ggridges) Ridgeplotdat1 %>% filter(n>5) %>% ggplot(aes(x = k, y = key, fill=key)) + geom_density_ridges()+ labs(title = stringr::str_wrap("Distribution of number of studies per major discipline in metadat::", 40), caption = paste(nrow(Ridgeplotdat1 %>% filter(n>5)), "out of", nrow(md), "datasets."), y="Major discipline")+ ggthemes::theme_base()
hybrid_n <- md %>% mutate(sample_size = map(raw_dat, get_n)) %>% select(dat_name,sample_size) %>% mutate(class = map_chr(sample_size, class)) %>% dplyr::filter(class == "numeric") %>% select(-class) long_n <- hybrid_n %>% unnest(cols = c(sample_size)) # why does this not plot? need to investigate further long_n %>% ggplot(aes(x = log(sample_size), y = dat_name)) + geom_density_ridges( colour = "grey", fill = "grey", alpha = 0.4 ) + labs( title = "Distributions of sample sizes in metadat:: datasets", y = "metadat:: dataset", x = "log(sample size)", caption = paste0(nrow(hybrid_n), " out of ", nrow(md), " datasets in the metadat:: package.") )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.