Skip to content

Commit

Permalink
Update to chartcatalog 1.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stefvanbuuren committed Dec 5, 2024
1 parent 1fa7313 commit 3f764ed
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: chartcatalog
Type: Package
Title: Catalog of JAMES Growth Charts
Version: 1.17.1
Version: 1.18.0
Authors@R: person("Stef", "van Buuren", email = "stef.vanbuuren@tno.nl", role = c("aut", "cre"))
Maintainer: Stef van Buuren <stef.vanbuuren@tno.nl>
Description: Tools for naming growth charts, and methods for
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# chartcatalog 1.18.0

* Extends the lookup table with a new field `refpkg` that indicates the package where the reference with name `refcode` can be found

# chartcatalog 1.17.1

* Adds getters for inverse transformations of `x` and `y`
Expand Down
2 changes: 2 additions & 0 deletions R/ynames_lookup.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@
#' then transform).}
#' \item{refcode}{A string coding the reference name recognised by
#' \code{centile::load_reference()}.}
#' \item{refpkg}{A string coding the package in which refcode can be found by
#' \code{centile::load_reference()}.}
#' }
"ynames_lookup"
16 changes: 16 additions & 0 deletions data-raw/R/ynames_lookup.R
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,22 @@ from <- data.frame(
)
ynames_lookup$refcode <- dplyr::left_join(from, conversion, by = c("lib", "clopus"))$centile

# repair faulty refcodes for WHO
ynames_lookup[ynames_lookup$refcode == "who_2011_bmi_female_", "refcode"] <- "who_2006_bmi_female_"
ynames_lookup[ynames_lookup$refcode == "who_2011_bmi_male_", "refcode"] <- "who_2006_bmi_male_"
ynames_lookup[ynames_lookup$refcode == "who_2011_hdc_female_", "refcode"] <- "who_2007_hdc_female_"
ynames_lookup[ynames_lookup$refcode == "who_2011_hdc_male_", "refcode"] <- "who_2007_hdc_male_"
ynames_lookup[ynames_lookup$refcode == "who_2011_hgt_female_", "refcode"] <- "who_2006_hdc_female_"
ynames_lookup[ynames_lookup$refcode == "who_2011_hgt_male_", "refcode"] <- "who_2006_hdc_male_"
ynames_lookup[ynames_lookup$refcode == "who_2011_wfh_female_", "refcode"] <- "who_2006_wfh_female_"
ynames_lookup[ynames_lookup$refcode == "who_2011_wfh_male_", "refcode"] <- "who_2006_wfh_male_"
ynames_lookup[ynames_lookup$refcode == "who_2011_wgt_female_", "refcode"] <- "who_2006_wgt_female_"
ynames_lookup[ynames_lookup$refcode == "who_2011_wgt_male_", "refcode"] <- "who_2006_wgt_male_"

# add refpkg column
ynames_lookup$refpkg <- NA_character_
ynames_lookup[strtrim(ynames_lookup$refcode, 2) %in% c("nl", "ph"), "refpkg"] <- "nlreferences"
ynames_lookup[strtrim(ynames_lookup$refcode, 3) == "who", "refpkg"] <- "centile"

# save
usethis::use_data(ynames_lookup, overwrite = TRUE)
Binary file modified data/ynames_lookup.rda
Binary file not shown.
2 changes: 2 additions & 0 deletions man/ynames_lookup.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3f764ed

Please sign in to comment.