From a7034634c79fa7bf0a9eea26b48d94891249600b Mon Sep 17 00:00:00 2001 From: "eva.alonso" Date: Fri, 16 Feb 2024 11:14:20 +0100 Subject: [PATCH] fix build --- DESCRIPTION | 3 +-- man/medusa.Rd | 21 ++++++++++++++++ tests/testthat/test_medusa.R | 47 +++++++++++++++++++++++------------- 3 files changed, 52 insertions(+), 19 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6dc4547..0e4a1e4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,7 +18,7 @@ Depends: R (>= 2.10) License: MIT + file LICENSE Encoding: UTF-8 LazyData: true -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 Imports: usethis, knitr, @@ -42,4 +42,3 @@ Suggests: devtools VignetteBuilder: knitr - diff --git a/man/medusa.Rd b/man/medusa.Rd index c58a39b..482d171 100644 --- a/man/medusa.Rd +++ b/man/medusa.Rd @@ -2,6 +2,7 @@ % Please edit documentation in R/medusa.R \docType{package} \name{medusa} +\alias{medusa-package} \alias{medusa} \title{medusa} \description{ @@ -9,3 +10,23 @@ \item Github: https://github.com/bc3LC/medusa \item Webpage: https://bc3lc.github.io/medusa/} } +\seealso{ +Useful links: +\itemize{ + \item \url{https://github.com/bc3LC/medusa} + \item Report bugs at \url{https://github.com/bc3LC/medusa/issues} +} + +} +\author{ +\strong{Maintainer}: Eva Alonso-Epelde \email{eva.alonso@bc3research.org} (\href{https://orcid.org/0000-0002-4052-1703}{ORCID}) + +Authors: +\itemize{ + \item Clàudia Rodés-Bachs \email{claudia.rodes@bc3research.org} (\href{https://orcid.org/0000-0001-6696-7685}{ORCID}) + \item María Moyano-Reina \email{maria.moyano@bc3research.org } (\href{https://orcid.org/0009-0000-4290-0697}{ORCID}) + \item Jon Sampedro \email{jon.sampedro@bc3research.org} (\href{https://orcid.org/0000-0002-2277-1530}{ORCID}) + \item Xaquín García-Muros \email{xaquin.garcia@bc3research.org } (\href{https://orcid.org/0000-0002-2667-3292}{ORCID}) +} + +} diff --git a/tests/testthat/test_medusa.R b/tests/testthat/test_medusa.R index acf805c..ca0fc06 100644 --- a/tests/testthat/test_medusa.R +++ b/tests/testthat/test_medusa.R @@ -60,7 +60,8 @@ test_that("Test4_Example intersectional variables csv", { test_that("Test5_Load raw hbs data", { - y <- seq(2006,2021,1) + #y <- seq(2006,2021,1) + y <- c(2006,2012,2019) db_path <- file.path(rprojroot::find_root(rprojroot::is_testthat), "test_inputs") options(timeout = max(300, getOption("timeout"))) #increase downloading time @@ -96,7 +97,9 @@ test_that("Test6_Standardize & rename values", { test_that("Test7_Add coicop", { - y <- seq(2006,2021,1) + #y <- seq(2006,2021,1) + y <- c(2006,2012,2019) + for (year in y){ path <- file.path(rprojroot::find_root(rprojroot::is_testthat), "test_inputs/coicop") lists <- read.csv(file.path(path, paste0("coicop_", year, ".csv"))) @@ -115,7 +118,9 @@ test_that("Test7_Add coicop", { test_that("Test8_Elevate_hbs population", { - y <- seq(2006,2021,1) + #y <- seq(2006,2021,1) + y <- c(2006,2012,2019) + country <-"ES" for (year in y){ pop_NA <- restatapi::get_eurostat_data("demo_gind", @@ -136,7 +141,9 @@ test_that("Test8_Elevate_hbs population", { test_that("Test8_Elevate_hbs expenses", { - y <- seq(2006,2021,1) + #y <- seq(2006,2021,1) + y <- c(2006,2012,2019) + country <-"ES" for (year in y){ @@ -173,7 +180,7 @@ test_that("Test9_Price_shock", { }) -test_that("Test10_Impact", { +test_that("Test10_Impact & basic graph", { path <- file.path(rprojroot::find_root(rprojroot::is_testthat), "test_inputs") epf <- read.csv(file.path(path, "ex_dataset_expenses_ps.csv")) shocks <- read.csv(file.path(path, "shocks_ps.csv")) @@ -186,10 +193,8 @@ test_that("Test10_Impact", { test_expect <- d_impacts testthat::expect_equal(test_result, test_expect) -}) - -test_that("Test11_Basic graph", { + #Check figures vars <- c("AGERP", "COUNTRYRP", "GENDERRP", "HHTYPE", "MUNISIZE", "REGION", "REGMR", "STUDIESRP", "ZONE" ) for (g in vars) { test_result <- png::readPNG(file.path(rprojroot::find_root(rprojroot::is_testthat), paste0("test_inputs/figures/DI_",g,".png"))) @@ -200,7 +205,7 @@ test_that("Test11_Basic graph", { }) -test_that("Test12_Impact Intersectional", { +test_that("Test11_Impact Intersectional", { path <- file.path(rprojroot::find_root(rprojroot::is_testthat), "test_inputs") epf <- read.csv(file.path(path, "ex_dataset_expenses_ps.csv")) shocks <- read.csv(file.path(path, "shocks_ps.csv")) @@ -219,8 +224,10 @@ test_that("Test12_Impact Intersectional", { }) -test_that("Test13_Calculate distributional impacts for all years (basic), no elevated", { - y <- seq(2006,2021,1) +test_that("Test12_Calculate distributional impacts for all years (basic), no elevated", { + #y <- seq(2006,2021,1) + y <- c(2006,2012,2019) + path <- file.path(rprojroot::find_root(rprojroot::is_testthat), "test_inputs") shocks <- read.csv(file.path(path, "shocks_cdi.csv")) @@ -239,8 +246,10 @@ test_that("Test13_Calculate distributional impacts for all years (basic), no ele }) -test_that("Test14_Calculate distributional impacts for all years (basic), elevated", { - y <- seq(2006,2021,1) +test_that("Test13_Calculate distributional impacts for all years (basic), elevated", { + #y <- seq(2006,2021,1) + y <- c(2006,2012,2019) + path <- file.path(rprojroot::find_root(rprojroot::is_testthat), "test_inputs") shocks <- read.csv(file.path(path, "shocks_cdi.csv")) @@ -259,8 +268,10 @@ test_that("Test14_Calculate distributional impacts for all years (basic), elevat }) -test_that("Test15_Calculate distributional impacts for all years (intersectional), no elevated", { - y <- seq(2006,2021,1) +test_that("Test14_Calculate distributional impacts for all years (intersectional), no elevated", { + #y <- seq(2006,2021,1) + y <- c(2006,2012,2019) + path <- file.path(rprojroot::find_root(rprojroot::is_testthat), "test_inputs") shocks <- read.csv(file.path(path, "shocks_cdii.csv")) @@ -279,8 +290,10 @@ test_that("Test15_Calculate distributional impacts for all years (intersectional }) -test_that("Test16_Calculate distributional impacts for all years (intersectional), no elevated", { - y <- seq(2006,2021,1) +test_that("Test15_Calculate distributional impacts for all years (intersectional), no elevated", { + #y <- seq(2006,2021,1) + y <- c(2006,2012,2019) + path <- file.path(rprojroot::find_root(rprojroot::is_testthat), "test_inputs") shocks <- read.csv(file.path(path, "shocks_cdii.csv"))