Skip to content

Commit

Permalink
Closes #15 adds CDC growth chart data created by code (#16)
Browse files Browse the repository at this point in the history
* initial commit

* chore: #15 rename growth charts with cdc_ prefix

* chore: #15 forgot to run `devtools::document()`

* styler, spelling, fix template

* add news snippet (#15)

* adopt way of housing data

* docs: #15 cleanup roxygen docs

* styler, lintr, roxygen

* rough draft of get_cdc_data()

* use `internal = TRUE`

* swap out snapshots

* cleanup template as well

* forgot .rd file

* clean back up news, use it next version

* chore: #15 cleanup stuff from github actions

* fix usethis() statement

* will this pass lintr instead

* make lintr exception is best course

* make an exception to all library() call because data is internal

* get around lintr

* feat: #15 adopt feedback

* rerun devtools, fix pipe, and meta.r file

* fix visual aesthetic of dataset description

* fix 9th decimal issue

* get past lintr

* add the last digit for S column in bmi page

* merge conflict for spelling
  • Loading branch information
zdz2101 authored Mar 19, 2024
1 parent f2b0f81 commit a4f30bd
Show file tree
Hide file tree
Showing 21 changed files with 1,497 additions and 188 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
^README.Rmd$
^data-raw$
^\.devcontainer$
^data-raw$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ admiraltemplate*.tgz

# Docs
docs/
inst/doc
3 changes: 2 additions & 1 deletion .lintr
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ exclusions: list(
"data-raw" = Inf,
"R/data.R" = Inf,
"inst" = list(undesirable_function_linter = Inf),
"vignettes" = list(undesirable_function_linter = Inf)
"vignettes" = list(undesirable_function_linter = Inf),
"tests/testthat/test-cdc_growth_charts.R" = list(undesirable_function_linter = Inf)
)
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ License: Apache License (>= 2)
URL: https://pharmaverse.github.io/admiralpeds,
https://github.com/pharmaverse/admiralpeds
Depends:
R (>= 4.0)
R (>= 4.1)
Imports:
admiral (>= 1.0.0),
admiraldev (>= 1.0.0),
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(hello_admiral)
export(get_cdc_data)
importFrom(admiral,derive_vars_dy)
importFrom(admiraldev,assert_character_scalar)
importFrom(admiraldev,assert_character_vector)
Expand Down
42 changes: 42 additions & 0 deletions R/get_cdc_data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#' Retrieve CDC growth chart metadataset
#'
#' Retrieves CDC growth chart metadataset
#'
#' @param type Type of Chart
#'
#' *Permitted Values*: `"height"`, `"weight"`, `"bmi"`
#'
#' @return A data-frame of the appropriate growth chart from the CDC data
#'
#' @details
#'
#' Each data frame will be denoted as below:
#' \describe{
#' \item{\code{SEX}}{Sex: 1 = male, 2 = female}
#' \item{\code{AGE}}{Age in months}
#' \item{\code{L}}{Box-Cox transformation for normality}
#' \item{\code{M}}{Median}
#' \item{\code{S}}{Coefficient of variation}
#' }
#'
#' This metadata is sourced from the
#' [CDC website](https://www.cdc.gov/growthcharts/percentile_data_files.htm).
#'
#' @family metadata
#' @keywords metadata
#'
#' @export
#'
#' @examples
#' get_cdc_data(type = "bmi")
get_cdc_data <- function(type) {
# Limit input values to the three datasets available from CDC data
assert_character_scalar(type, values = c("height", "weight", "bmi"))

# Grab the appropriate one
switch(type,
height = cdc_htage,
weight = cdc_wtage,
bmi = cdc_bmiage
)
}
28 changes: 0 additions & 28 deletions R/my_first_fcn.R

This file was deleted.

Binary file added R/sysdata.rda
Binary file not shown.
52 changes: 2 additions & 50 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,54 +17,6 @@ development:
mode: auto

reference:
- title: Derivations for Adding Variables
- subtitle: ADXX-specific
desc: Derivation Functions helpful for building the ADXX dataset
- title: Metadata
- contents:
- has_keyword("der_adxx")

- title: Derivations for Adding Parameters
- subtitle: ADXX-specific
desc: Parameter Derivation Functions helpful for building the ADXX dataset
- contents:
- has_keyword("der_prm_adxx")

- title: Advanced Functions
- subtitle: Pre-Defined Source Objects
desc: Source objects defined by {admiralpeds}
- contents:
- has_keyword("source_specifications")

- title: Utility Functions
- subtitle: Utilities for Formatting Observations
- contents:
- has_keyword('utils_fmt')

- subtitle: Utilities for Dataset Checking
- contents:
- has_keyword('utils_ds_chk')

- subtitle: Utilities for Filtering Observations
- contents:
- has_keyword('utils_fil')

- title: Example Datasets
desc: You can run `admiral::use_ad_template()` to produce additional datasets
- contents:
- has_keyword('datasets')

navbar:
structure:
left: [getstarted, reference, articles, news]
components:
getstarted:
text: Get Started
href: articles/admiralpeds.html
reference:
text: Reference
href: reference/index.html
articles:
text: User Guides
menu:
- text: Creating ADXX
href: articles/adxx.html
- has_keyword("metadata")
Loading

0 comments on commit a4f30bd

Please sign in to comment.