From ebdedbc58e4cc7344919abfe12b7fe86c8cbfb39 Mon Sep 17 00:00:00 2001 From: Anne Cori Date: Fri, 26 Apr 2024 17:10:16 +0100 Subject: [PATCH 1/2] new function to pre process parameter dataframes for meta analysis of proportions --- priority-pathogens.Rproj | 4 ++++ shared/lassa_functions.R | 10 +++------- src/lassa_severity/orderly.R | 6 ++++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/priority-pathogens.Rproj b/priority-pathogens.Rproj index 8e3c2ebc..21a4da08 100644 --- a/priority-pathogens.Rproj +++ b/priority-pathogens.Rproj @@ -11,3 +11,7 @@ Encoding: UTF-8 RnwWeave: Sweave LaTeX: pdfLaTeX + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source diff --git a/shared/lassa_functions.R b/shared/lassa_functions.R index 8646f330..5f331d7e 100644 --- a/shared/lassa_functions.R +++ b/shared/lassa_functions.R @@ -232,13 +232,9 @@ metaprop_wrap <- function(dataframe, subgroup, plot_pooled, sort_by_subg, plot_study, digits, colour, width, height, resolution){ - stopifnot(length(unique(dataframe$parameter_unit[!is.na(dataframe$parameter_unit)])) == 1)#values must have same units - - dataframe <- dataframe %>% filter(!is.na(cfr_ifr_denominator)) %>% - filter(!(is.na(cfr_ifr_numerator)&is.na(parameter_value))) %>% - mutate(cfr_ifr_numerator = case_when( - is.na(cfr_ifr_numerator) & !is.na(parameter_value) ~ round((parameter_value/100)*cfr_ifr_denominator), - TRUE ~ cfr_ifr_numerator)) + dataframe <- epireview::filter_df_for_metaprop(dataframe, + num_col = "cfr_ifr_numerator", + denom_col = "cfr_ifr_denominator") mtan <- metaprop(data = dataframe, studlab = refs, diff --git a/src/lassa_severity/orderly.R b/src/lassa_severity/orderly.R index f13ba349..42c23c4e 100644 --- a/src/lassa_severity/orderly.R +++ b/src/lassa_severity/orderly.R @@ -17,6 +17,12 @@ library(png) library(grid) library(patchwork) library(gridExtra) +if(packageVersion("epireview") < "1.1.2") { + error_msg <- + paste("Please download the latest development version of epireview using:", + "devtools::install_github('mrc-ide/epireview@develop')") + stop(error_msg) +} #orderly preparation orderly_strict_mode() From 5761f47d3ba43b9a75a1f69cb3a70a672e76bdbf Mon Sep 17 00:00:00 2001 From: Anne Cori Date: Mon, 29 Apr 2024 13:13:05 +0100 Subject: [PATCH 2/2] bump epireview version --- src/lassa_severity/orderly.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lassa_severity/orderly.R b/src/lassa_severity/orderly.R index 42c23c4e..94613470 100644 --- a/src/lassa_severity/orderly.R +++ b/src/lassa_severity/orderly.R @@ -17,7 +17,7 @@ library(png) library(grid) library(patchwork) library(gridExtra) -if(packageVersion("epireview") < "1.1.2") { +if(packageVersion("epireview") < "1.1.3") { error_msg <- paste("Please download the latest development version of epireview using:", "devtools::install_github('mrc-ide/epireview@develop')")