From a2b0b77385fe9323ccf2f588815abb94d0b483e4 Mon Sep 17 00:00:00 2001 From: athowes Date: Mon, 20 Nov 2023 12:48:58 +0000 Subject: [PATCH] Add available-surveys as gt output for thesis --- src/docs_thesis-resources/orderly.yml | 1 + src/plot_available-surveys/orderly.yml | 1 + src/plot_available-surveys/script.R | 10 ++++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/docs_thesis-resources/orderly.yml b/src/docs_thesis-resources/orderly.yml index 55917e3..fc0974d 100644 --- a/src/docs_thesis-resources/orderly.yml +++ b/src/docs_thesis-resources/orderly.yml @@ -71,6 +71,7 @@ depends: use: depends/available-surveys.png: available-surveys.png depends/available-surveys.csv: available-surveys.csv + depends/available-surveys.rds: available-surveys.rds plot-tikz_category-flowchart: id: latest use: diff --git a/src/plot_available-surveys/orderly.yml b/src/plot_available-surveys/orderly.yml index 48f4370..176afde 100644 --- a/src/plot_available-surveys/orderly.yml +++ b/src/plot_available-surveys/orderly.yml @@ -8,6 +8,7 @@ artefacts: - available-surveys.png - available-surveys.csv - available-surveys.txt + - available-surveys.rds - data: description: Comparison of surveys listed on STATcompiler versus those we have filenames: diff --git a/src/plot_available-surveys/script.R b/src/plot_available-surveys/script.R index 7c42033..9fc35bd 100644 --- a/src/plot_available-surveys/script.R +++ b/src/plot_available-surveys/script.R @@ -115,7 +115,7 @@ ggsave( width = 6.25, height = 3.5, units = "in", dpi = 300 ) -df %>% +available_surveys_gt <- df %>% select(country, type, year, giftsvar, Y015_019, Y020_024, Y025_029, Y015_029) %>% mutate( giftsvar = case_when( @@ -152,12 +152,18 @@ df %>% drop_trailing_zeros = TRUE, missing_text = "", sep_mark = "" - ) %>% + ) + +saveRDS(available_surveys_gt, "available-surveys.rds") + +available_surveys_gt %>% as_latex() %>% as.character() %>% cat(file = "available-surveys.txt") #' What was the raw FSW proportion in surveys with and without a specific transactional question? +giftsvar_surveys <- filter(df, giftsvar == 1) %>% pull(survey_id) + lapply(files, function(file) { read_csv(file) }) %>%