The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Title: Produce Standard/Formalized Demographics Tables
Description: Augment clinical data with metadata to create output used in conventional publications and reports.
Version: 0.3.0
URL: https://ouhscbbmc.github.io/codified/, https://github.com/OuhscBbmc/codified, https://github.com/higgi13425/nih_enrollment_table
BugReports: https://github.com/OuhscBbmc/codified/issues
Depends: R(≥ 4.1.0)
Imports: checkmate (≥ 1.8.4), dplyr (≥ 1.0.0), kableExtra, knitr (≥ 1.18.0), rlang, tibble (≥ 1.4.0), tidyr (≥ 1.0.0)
Suggests: covr, readr (≥ 1.1.0), REDCapR, rmarkdown, testthat (≥ 3.0)
License: MIT + file LICENSE
VignetteBuilder: knitr
Encoding: UTF-8
RoxygenNote: 7.2.1
Config/testthat/edition: 3
Language: en-US
NeedsCompilation: no
Packaged: 2022-08-12 13:13:21 UTC; Will
Author: Will Beasley ORCID iD [aut, cre], Peter Higgins [ctb]
Maintainer: Will Beasley <wibeasley@hotmail.com>
Repository: CRAN
Date/Publication: 2022-08-12 13:40:06 UTC

codified: Produce Standard/Formalized Demographics Tables

Description

Augment clinical data with metadata to create output used in conventional publications and reports.

Author(s)

Maintainer: Will Beasley wibeasley@hotmail.com (ORCID)

Other contributors:

See Also

Useful links:


Produce an NIH-compliant enrollment table.

Description

Produce an NIH enrollment table, leveraging metadata to adapt to the observed data.frame.

Usage

table_nih_enrollment(
  d,
  d_lu_gender = NULL,
  d_lu_race = NULL,
  d_lu_ethnicity = NULL,
  variable_gender = "gender",
  variable_race = "race",
  variable_ethnicity = "ethnicity"
)

Arguments

d

data.frame of observed values in the investigation. Required.

d_lu_gender

data.frame that maps the observed levels of gender to the NIH-recommended levels of gender. Required only if the levels are not the same.

d_lu_race

data.frame that maps the observed levels of gender to the NIH-recommended levels of gender. Required only if the levels are not the same.

d_lu_ethnicity

data.frame that maps the observed levels of gender to the NIH-recommended levels of gender. Required only if the levels are not the same.

variable_gender

name of the gender variable in the d data.frame. Defaults to gender.

variable_race

name of the race variable in the d data.frame. Defaults to race.

variable_ethnicity

name of the ethnicity variable in the d data.frame. Defaults to ethnicity.

Details

https://grants.nih.gov/grants/how-to-apply-application-guide/forms-d/general/g.500-phs-inclusion-enrollment-report.htm

Value

Table for publication

Author(s)

Will Beasley, Peter Higgins, Andrew Peters, Sreeharsha Mandem

Examples

ds_1 <- tibble::tribble(
  ~subject_id,   ~gender  , ~race                      ,   ~ethnicity                     ,
           1L,   "Male"   , "Black or African American",  "Not Hispanic or Latino"        ,
           2L,   "Male"   , "Black or African American",  "Not Hispanic or Latino"        ,
           3L,   "Female" , "Black or African American",  "Unknown/Not Reported Ethnicity",
           4L,   "Male"   , "White"                    ,  "Not Hispanic or Latino"        ,
           5L,   "Male"   , "White"                    ,  "Not Hispanic or Latino"        ,
           6L,   "Female" , "White"                    ,  "Not Hispanic or Latino"        ,
           7L,   "Male"   , "White"                    ,  "Hispanic or Latino"            ,
           8L,   "Male"   , "White"                    ,  "Hispanic or Latino"
)

table_nih_enrollment(ds_1)
table_nih_enrollment_pretty(ds_1)

table_nih_enrollment(ds_1) |>
  tidyr::pivot_wider(names_from = gender, values_from = n)

table_nih_enrollment(ds_1) |>
  dplyr::mutate(
    gender_ethnicity = paste0(gender, " by ", ethnicity)
  ) |>
  dplyr::select(-gender, -ethnicity) |>
  tidyr::pivot_wider(names_from = gender_ethnicity, values_from = n)

ds_2 <- tibble::tribble(
  ~subject_id,  ~gender , ~race                      , ~ethnicity    ,
           1L,  "Male"  , "Black or African American", "Not Latino"  ,
           2L,  "Male"  , "Black or African American", "Not Latino"  ,
           3L,  "Female", "Black or African American", "Unknown"     ,
           4L,  "Male"  , "White"                    , "Not Latino"  ,
           5L,  "Male"  , "White"                    , "Not Latino"  ,
           6L,  "Female", "White"                    , "Not Latino"  ,
           7L,  "Male"  , "White"                    , "Latino"      ,
           8L,  "Male"  , "White"                    , "Latino"
)

ds_lu_ethnicity <- tibble::tribble(
  ~input      ,   ~displayed                      ,
  "Not Latino",  "Not Hispanic or Latino"         ,
  "Latino"    ,  "Hispanic or Latino"             ,
  "Unknown"   ,  "Unknown/Not Reported Ethnicity"
)
table_nih_enrollment(ds_2, d_lu_ethnicity = ds_lu_ethnicity)
table_nih_enrollment_pretty(ds_2, d_lu_ethnicity = ds_lu_ethnicity)

## Read a 500-patient fake dataset
path <- system.file("misc/example-data-1.csv", package = "codified")
ds_3 <- readr::read_csv(path) |>
  dplyr::mutate(
    gender     = as.character(gender),
    race       = as.character(race),
    ethnicity  = as.character(ethnicity)
  )

ds_lu_gender <- tibble::tribble(
  ~input,   ~displayed                      ,
  "0"   ,  "Female",
  "1"   ,  "Male",
  "U"   ,  "Unknown/Not Reported"
)
ds_lu_race <- tibble::tribble(
  ~input ,   ~displayed                      ,
  "1"    , "American Indian/Alaska Native",
  "2"    , "Asian",
  "3"    , "Native Hawaiian or Other Pacific Islander",
  "4"    , "Black or African American",
  "5"    , "White",
  "M"    , "More than One Race",
  "6"    , "Unknown or Not Reported"
)
ds_lu_ethnicity <- tibble::tribble(
  ~input,   ~displayed                      ,
  "2"   ,  "Not Hispanic or Latino"         ,
  "1"   ,  "Hispanic or Latino"             ,
  "0"   ,  "Unknown/Not Reported Ethnicity"
)

table_nih_enrollment(
  d              = ds_3,
  d_lu_gender    = ds_lu_gender,
  d_lu_race      = ds_lu_race,
  d_lu_ethnicity = ds_lu_ethnicity
)

table_nih_enrollment_pretty(
  d              = ds_3,
  d_lu_gender    = ds_lu_gender,
  d_lu_race      = ds_lu_race,
  d_lu_ethnicity = ds_lu_ethnicity
)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.