From 941f22cd790a9489b580724c62d6d6f690bc0ee9 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Tue, 12 Mar 2024 15:40:36 +0100 Subject: [PATCH] bugfix in aggregation weight AgCapLabourShare --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- R/calcAgCapLabourShare.R | 3 ++- README.md | 6 +++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index aea51a2..c46166b 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '6134590' +ValidationKey: '6155934' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index e08cb8c..9485f7e 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -2,8 +2,8 @@ cff-version: 1.2.0 message: If you use this software, please cite it using the metadata from this file. type: software title: 'mrfactors: MADRaT based package on factor inputs' -version: 0.3.10 -date-released: '2024-03-07' +version: 0.3.11 +date-released: '2024-03-12' abstract: This package provides functions for MAgPIE input data on factor inputs to agricultural production (with a focus on capital and labor). authors: diff --git a/DESCRIPTION b/DESCRIPTION index 16a122b..598674f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mrfactors Title: MADRaT based package on factor inputs -Version: 0.3.10 -Date: 2024-03-07 +Version: 0.3.11 +Date: 2024-03-12 Authors@R: c(person("Debbora", "Leip", , "leip@pik-potsdam.de", role = c("aut", "cre")), person("Edna", "Molina Bacca", role = "aut")) diff --git a/R/calcAgCapLabourShare.R b/R/calcAgCapLabourShare.R index 9bb769b..3d1c0ae 100644 --- a/R/calcAgCapLabourShare.R +++ b/R/calcAgCapLabourShare.R @@ -34,8 +34,9 @@ calcAgCapLabourShare <- function() { if (any(missingYears > min(getYears(weight, as.integer = TRUE)))) { stop("Need to fix weight for new years not covered in factor costs dataset") } + minYear <- min(getYears(weight, as.integer = TRUE)) weight <- magpiesort(add_columns(weight, dim = 2, addnm = paste0("y", missingYears))) - weight[, missingYears, ] <- weight[, min(getYears(weight, as.integer = TRUE)), ] + weight[, missingYears, ] <- weight[, minYear, ] # Give 0 weigh to countries with unexpectedly high capital shares weight[c("BLZ", "CRI", "DOM", "HND", "JAM", "MEX", "NIC", "PAN", "SLV"), , ] <- 0 diff --git a/README.md b/README.md index f3eb7a0..8a8880c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MADRaT based package on factor inputs -R package **mrfactors**, version **0.3.10** +R package **mrfactors**, version **0.3.11** [![CRAN status](https://www.r-pkg.org/badges/version/mrfactors)](https://cran.r-project.org/package=mrfactors) [![R build status](https://github.com/pik-piam/mrfactors/workflows/check/badge.svg)](https://github.com/pik-piam/mrfactors/actions) [![codecov](https://codecov.io/gh/pik-piam/mrfactors/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrfactors) [![r-universe](https://pik-piam.r-universe.dev/badges/mrfactors)](https://pik-piam.r-universe.dev/builds) @@ -38,7 +38,7 @@ In case of questions / problems please contact Debbora Leip . +Leip D, Molina Bacca E (2024). _mrfactors: MADRaT based package on factor inputs_. R package version 0.3.11, . A BibTeX entry for LaTeX users is @@ -47,7 +47,7 @@ A BibTeX entry for LaTeX users is title = {mrfactors: MADRaT based package on factor inputs}, author = {Debbora Leip and Edna {Molina Bacca}}, year = {2024}, - note = {R package version 0.3.10}, + note = {R package version 0.3.11}, url = {https://github.com/pik-piam/mrfactors}, } ```