diff --git a/DESCRIPTION b/DESCRIPTION index 0b7402c..69f6b67 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,9 +1,9 @@ Package: codified -Title: Produce standard/formalized demographics tables +Title: Produce Standard/Formalized Demographics Tables Description: Augment clinical data with metadata to create output used in conventional publications and reports. -Version: 0.1.1.9001 -Date: 2018-08-27 +Version: 0.2.0 +Date: 2018-09-06 Authors@R: c(person("Will", "Beasley", role = c("aut", "cre"), email = "wibeasley@hotmail.com", comment = c(ORCID = "0000-0002-5613-5006")), person("Peter", "Higgins", role = "ctb")) @@ -13,24 +13,21 @@ Depends: R(>= 3.0.0), stats Imports: + checkmate (>= 1.8.4), dplyr (>= 0.7.0), + kableExtra, + knitr (>= 1.18.0), magrittr, methods, - readr (>= 1.2.0), + readr (>= 1.1.0), rlang, tibble (>= 1.4.0), tidyr (>= 0.7.0) Suggests: - checkmate (>= 1.8.4), devtools, - kableExtra, - knitr (>= 1.18.0), REDCapR, rmarkdown, - sessioninfo, - testthat (>= 0.9) -Remotes: - github::tidyverse/readr + testthat (>= 2.0) License: MIT + file LICENSE LazyData: TRUE VignetteBuilder: knitr diff --git a/NEWS.md b/NEWS.md index 9343073..9d84c50 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ -# codified 0.0.1.9001 -* Added a `NEWS.md` file to track changes to the package. +# codified 0.2.0 + +* added `table_nih_enrollment()` and `table_nih_enrollment_pretty()`. #2 +* added `nih-enrollment-html` vignette. #6 +* started pkgdown site. #7 +* the idea was created by [Peter Higgins](http://www.med.umich.edu/higginslab/) (@higgi13425) for [R/Medicine 2018](http://r-medicine.com/). diff --git a/R/table-nih-enrollment.R b/R/table-nih-enrollment.R index b65e69c..47def13 100644 --- a/R/table-nih-enrollment.R +++ b/R/table-nih-enrollment.R @@ -1,7 +1,7 @@ #' @name table_nih_enrollment #' @aliases table_nih_enrollment table_nih_enrollment_pretty #' -#' @title Produce an NIH-compliant enrolment table. +#' @title Produce an NIH-compliant enrollment table. #' #' @description Produce an NIH enrollment table, leveraging metadata to adapt to the observed [data.frame]. #' diff --git a/README.md b/README.md index 29c807a..814b40f 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ devtools::install_github(repo="OuhscBbmc/codified") In the future, the *release* version can be installed from [CRAN](https://cran.r-project.org/package=codified). ```r -# install.packages("codified") # Not yet on CRAN. +install.packages("codified") ``` The package can be uninstalled from your local machine with `remove.packages("codified")`. diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..0aedee5 --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,31 @@ +Description +----------------------------------------------- +This is a new release. + +Thank you for taking the time to review my submission, and please tell me if there's something else I should do for CRAN. -Will Beasley + + +Test environments +----------------------------------------------- + +The win-builder and a local machine have used the CRAN version of dplyr. The others have used the current GitHub master version of dplyr. + +* Local Ubuntu, R 3.5.1 patched +* [win-builder](https://win-builder.r-project.org/9fyA0Vz5XQNU/) (version="R-devel") +* [Travis CI](https://travis-ci.org/OuhscBbmc/codified), Ubuntu LTS +* [AppVeyor](https://ci.appveyor.com/project/wibeasley/codified), Windows Server + + +R CMD check results +----------------------------------------------- + +* No ERRORs or WARNINGs on any builds. + +* No NOTEs other than 'New submission' + + +Downstream dependencies +----------------------------------------------- + +No other packages depend/import this one. + diff --git a/docs/CODE_OF_CONDUCT.html b/docs/CODE_OF_CONDUCT.html index 65d0ab4..5d76344 100644 --- a/docs/CODE_OF_CONDUCT.html +++ b/docs/CODE_OF_CONDUCT.html @@ -58,7 +58,7 @@ codified - 0.0.1.9001 + 0.2.0 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 1a22e72..3e01e6f 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -58,7 +58,7 @@ codified - 0.0.1.9001 + 0.2.0 diff --git a/docs/articles/index.html b/docs/articles/index.html index 61abb3f..10a3330 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -58,7 +58,7 @@ codified - 0.0.1.9001 + 0.2.0 diff --git a/docs/articles/nih-enrollment-html.html b/docs/articles/nih-enrollment-html.html index e47f60f..8af2a79 100644 --- a/docs/articles/nih-enrollment-html.html +++ b/docs/articles/nih-enrollment-html.html @@ -29,7 +29,7 @@ codified - 0.0.1.9001 + 0.2.0 @@ -1038,24 +1038,45 @@

devtools::install_github("OuhscBbmc/REDCapR") library(REDCapR) -

Next, download the data from the REDCap database into the ds_2 data.frame.

+

Next, download the data from the REDCap database into the ds_2 data.frame. If you’re running the most recent version of REDCapR (available on GitHub), the code will be:

ds_2 <- REDCapR::redcap_read_oneshot(
   redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/",  # URL of REDCap Server.
-  token      = "F304DEC3793FECC3B6DEEFF66302CAD3",    # User-speciifc token/password.
+  token      = "F304DEC3793FECC3B6DEEFF66302CAD3",    # User-specific token/password.
   guess_type = FALSE                                  # Keep all variables as strings/characters.
-)$data
-
## 500 records and 13 columns were read from REDCap in 1.7 seconds.  The http status code was 200.
+)$data +

The following code is more complicated than normal, because the vignette has to account for different versions of REDCapR being installed on the machine.

+
if( !requireNamespace("REDCapR", quietly=TRUE) ) {
+  ds <- ds_2 # If REDCapR isn't installed, use the previous version of the dataset.
+} else if( "0.9.8" < packageVersion("REDCapR") ) {
+  ds_2 <- REDCapR::redcap_read_oneshot(
+    redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/",  # URL of REDCap Server.
+    token      = "F304DEC3793FECC3B6DEEFF66302CAD3",    # User-specific token/password.
+    guess_type = FALSE                                  # Keep all variables as strings/characters.
+  )$data  
+} else {
+  # Older versions of REDCapR don't have the `guess_type` parameter
+  ds_2 <- REDCapR::redcap_read_oneshot(
+    redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/",  # URL of REDCap Server.
+    token      = "F304DEC3793FECC3B6DEEFF66302CAD3"     # User-specific token/password.
+  )$data %>% 
+    dplyr::mutate(
+      gender      = as.character(gender),
+      race        = as.character(race),
+      ethnicity   = as.character(ethnicity)
+    )
+}
+
## 500 records and 13 columns were read from REDCap in 0.7 seconds.  The http status code was 200.

Conform to NIH Cosmetics

Now, convert these demographic data into a properly formatted NIH enrollment table. Pass the ds_lu_gender, ds_lu_race, and ds_lu_ethnicity metadata, which was defined above. As a reminder, these translate values like 1 to Male and 3 to Native Hawaiian or Other Pacific Islander.

- + @@ -1352,35 +1373,35 @@

Collapsing Levels

Many observed datasets may collect race with a different set of levels. For instance in ds_3, the American Indian level is separate from the Alaska Native level. In the first and second rows in the metadata below, the two levels are effectively combined into theAmerican Indian/Alaska Native level, so it complies with the format of the NIH Enrollment table.

- +
diff --git a/docs/authors.html b/docs/authors.html index eaae250..feb579c 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -58,7 +58,7 @@ codified - 0.0.1.9001 + 0.2.0 diff --git a/docs/index.html b/docs/index.html index 741e450..c02cf7f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -30,7 +30,7 @@ codified - 0.0.1.9001 + 0.2.0 @@ -84,15 +84,16 @@ codified

Produce standard/formalized demographics tables

Clinical researchers often need to document and report the demographics of all consented subjects. A common use case is for reporting to funding agencies, including the National Institutes of Health (NIH). The NIH requires a particular format for the PHS Inclusion Enrollment Report in each annual Research Performance Progress Report (RPPR).

-

The codified package, in combination with the REDCapR package, provides a pipeline to directly extract the demographics of consented subjects from a REDCap database, and to rapidly and reproducibly produce standard demographics tables.

+

The codified package, in combination with the REDCapR package, provides a pipeline to directly extract the demographics of consented subjects from a REDCap database, and to rapidly and reproducibly produce standard demographics tables. This pipeline is demonstrated in the vignette, NIH Enrollment Tables in HTML.

Installation and Documentation

-

In the future, the release version can be installed from CRAN.

-

The development version can be installed from GitHub after installing the devtools package.

- + +

In the future, the release version can be installed from CRAN.

+ +

The package can be uninstalled from your local machine with remove.packages("codified").

@@ -130,16 +131,22 @@

- + + - + + + + + +
Key Value
License License: MIT
Development DocRdoc
+-->
diff --git a/docs/news/index.html b/docs/news/index.html index a384371..4c1e79f 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -58,7 +58,7 @@ codified - 0.0.1.9001 + 0.2.0 @@ -113,11 +113,13 @@

Changelog

Source: NEWS.md -
+

-codified 0.0.1.9001

+codified 0.2.0
@@ -126,7 +128,7 @@

Contents

diff --git a/docs/reference/codified-package.html b/docs/reference/codified-package.html index 1bdfd6d..ec346a1 100644 --- a/docs/reference/codified-package.html +++ b/docs/reference/codified-package.html @@ -62,7 +62,7 @@ codified - 0.0.1.9001 + 0.2.0 @@ -129,6 +129,7 @@

codified: Produce standard/formalized demographics tables

See also

Useful links:

diff --git a/docs/reference/table_nih_enrollment.html b/docs/reference/table_nih_enrollment.html index c1e9f8c..778d416 100644 --- a/docs/reference/table_nih_enrollment.html +++ b/docs/reference/table_nih_enrollment.html @@ -61,7 +61,7 @@ codified - 0.0.1.9001 + 0.2.0 diff --git a/documentation-for-developers/refresh.R b/documentation-for-developers/refresh.R index 4bf1797..49a3b94 100644 --- a/documentation-for-developers/refresh.R +++ b/documentation-for-developers/refresh.R @@ -16,3 +16,8 @@ test_results_checked <- devtools::test() test_results_checked <- devtools::test(filter = "table-nih-enrollment") # testthat::test_dir("./tests/") test_results_not_checked <- testthat::test_dir("./tests/manual/") + +# devtools::check(force_suggests = FALSE) +# devtools::build_win(version="R-devel") #CRAN submission policies encourage the development version +# devtools::revdep_check(pkg="codified", recursive=TRUE) +# devtools::release(check=FALSE) #Careful, the last question ultimately uploads it to CRAN, where you can't delete/reverse your decision. diff --git a/inst/doc/nih-enrollment-html.R b/inst/doc/nih-enrollment-html.R index 6a0cae0..01b0aba 100644 --- a/inst/doc/nih-enrollment-html.R +++ b/inst/doc/nih-enrollment-html.R @@ -84,11 +84,26 @@ if( !requireNamespace("REDCapR", quietly=T) ) library(REDCapR) ## ----redcap-establish---------------------------------------------------- -ds_2 <- REDCapR::redcap_read_oneshot( - redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/", # URL of REDCap Server. - token = "F304DEC3793FECC3B6DEEFF66302CAD3", # User-speciifc token/password. - guess_type = FALSE # Keep all variables as strings/characters. -)$data +if( !requireNamespace("REDCapR", quietly=TRUE) ) { + ds <- ds_2 # If REDCapR isn't installed, use the previous version of the dataset. +} else if( "0.9.8" < packageVersion("REDCapR") ) { + ds_2 <- REDCapR::redcap_read_oneshot( + redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/", # URL of REDCap Server. + token = "F304DEC3793FECC3B6DEEFF66302CAD3", # User-specific token/password. + guess_type = FALSE # Keep all variables as strings/characters. + )$data +} else { + # Older versions of REDCapR don't have the `guess_type` parameter + ds_2 <- REDCapR::redcap_read_oneshot( + redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/", # URL of REDCap Server. + token = "F304DEC3793FECC3B6DEEFF66302CAD3" # User-specific token/password. + )$data %>% + dplyr::mutate( + gender = as.character(gender), + race = as.character(race), + ethnicity = as.character(ethnicity) + ) +} ## ----redcap-local-cosmetically-format------------------------------------ table_nih_enrollment_pretty( @@ -129,4 +144,3 @@ table_nih_enrollment_pretty( d_lu_race = ds_lu_race_3 ) - diff --git a/inst/doc/nih-enrollment-html.Rmd b/inst/doc/nih-enrollment-html.Rmd index 7470fc9..c87a0df 100644 --- a/inst/doc/nih-enrollment-html.Rmd +++ b/inst/doc/nih-enrollment-html.Rmd @@ -135,14 +135,38 @@ if( !requireNamespace("REDCapR", quietly=T) ) library(REDCapR) ``` -Next, download the data from the REDCap database into the `ds_2` data.frame. +Next, download the data from the REDCap database into the `ds_2` data.frame. If you're running the most recent version of REDCapR (available on GitHub), the code will be: -```{r redcap-establish} +```r ds_2 <- REDCapR::redcap_read_oneshot( redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/", # URL of REDCap Server. - token = "F304DEC3793FECC3B6DEEFF66302CAD3", # User-speciifc token/password. + token = "F304DEC3793FECC3B6DEEFF66302CAD3", # User-specific token/password. guess_type = FALSE # Keep all variables as strings/characters. -)$data +)$data +``` +The following code is more complicated than normal, because the vignette has to account for different versions of REDCapR being installed on the machine. + +```{r redcap-establish} +if( !requireNamespace("REDCapR", quietly=TRUE) ) { + ds <- ds_2 # If REDCapR isn't installed, use the previous version of the dataset. +} else if( "0.9.8" < packageVersion("REDCapR") ) { + ds_2 <- REDCapR::redcap_read_oneshot( + redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/", # URL of REDCap Server. + token = "F304DEC3793FECC3B6DEEFF66302CAD3", # User-specific token/password. + guess_type = FALSE # Keep all variables as strings/characters. + )$data +} else { + # Older versions of REDCapR don't have the `guess_type` parameter + ds_2 <- REDCapR::redcap_read_oneshot( + redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/", # URL of REDCap Server. + token = "F304DEC3793FECC3B6DEEFF66302CAD3" # User-specific token/password. + )$data %>% + dplyr::mutate( + gender = as.character(gender), + race = as.character(race), + ethnicity = as.character(ethnicity) + ) +} ``` @@ -195,8 +219,8 @@ table_nih_enrollment_pretty( d = ds_3, d_lu_race = ds_lu_race_3 ) - ``` + Feedback Welcome ===================================================== diff --git a/inst/doc/nih-enrollment-html.html b/inst/doc/nih-enrollment-html.html index ea71978..62ee2f3 100644 --- a/inst/doc/nih-enrollment-html.html +++ b/inst/doc/nih-enrollment-html.html @@ -11,7 +11,7 @@ - + NIH Enrollment Tables in HTML @@ -1492,7 +1492,7 @@

NIH Enrollment Tables in HTML

Will Beasley and Peter Higgins

-

2018-09-05

+

2018-09-06

@@ -1530,231 +1530,97 @@

2.1 Establish Datasets

head(10) %>% knitr::kable(caption = "Observed Dataset (first ten rows)") - + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
-Observed Dataset (first ten rows) -Observed Dataset (first ten rows)
-record_id - -name_last - -dob - -ethnicity - -race - -gender -
record_idname_lastdobethnicityracegender
-1 - -Cornel - -1991-05-13 - -1 - -4 - -0 -
-2 - -Wojdyla - -1931-10-14 - -1 - -4 - -0 -
-3 - -Stunkard - -1964-09-15 - -1 - -3 - -1 -
-4 - -Cimochowski - -1969-05-03 - -1 - -4 - -1 -
-5 - -Woodland - -1969-11-22 - -1 - -4 - -0 -
-6 - -Pistoia - -1943-08-26 - -1 - -4 - -1 -
-7 - -Ahlquist - -1944-01-22 - -1 - -4 - -0 -
-8 - -Ashlin - -1931-04-14 - -1 - -4 - -1 -
-9 - -Djokovic - -1962-07-07 - -1 - -1 - -1 -
-10 - -Mosses - -1978-06-20 - -1 - -3 - -0 -
1Cornel1991-05-13140
2Wojdyla1931-10-14140
3Stunkard1964-09-15131
4Cimochowski1969-05-03141
5Woodland1969-11-22140
6Pistoia1943-08-26141
7Ahlquist1944-01-22140
8Ashlin1931-04-14141
9Djokovic1962-07-07111
10Mosses1978-06-20130
@@ -1766,43 +1632,25 @@

2.1 Establish Datasets

) knitr::kable(ds_lu_gender, caption = "Gender Mapping") - + - - - + + + - - - + + + - - - + + + - - - + + +
-Gender Mapping -Gender Mapping
-input - -displayed -
inputdisplayed
-0 - -Female -
0Female
-1 - -Male -
1Male
-U - -Unknown/Not Reported -
UUnknown/Not Reported
@@ -1818,75 +1666,41 @@

2.1 Establish Datasets

) knitr::kable(ds_lu_race, caption = "Race Mapping") - + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
-Race Mapping -Race Mapping
-input - -displayed -
inputdisplayed
-1 - -American Indian/Alaska Native -
1American Indian/Alaska Native
-2 - -Asian -
2Asian
-3 - -Native Hawaiian or Other Pacific Islander -
3Native Hawaiian or Other Pacific Islander
-4 - -Black or African American -
4Black or African American
-5 - -White -
5White
-M - -More than One Race -
MMore than One Race
-6 - -Unknown or Not Reported -
6Unknown or Not Reported
@@ -1898,43 +1712,25 @@

2.1 Establish Datasets

) knitr::kable(ds_lu_ethnicity, caption = "Ethnicity Mapping") - + - - - + + + - - - + + + - - - + + + - - - + + +
-Ethnicity Mapping -Ethnicity Mapping
-input - -displayed -
inputdisplayed
-2 - -Not Hispanic or Latino -
2Not Hispanic or Latino
-1 - -Hispanic or Latino -
1Hispanic or Latino
-0 - -Unknown/Not Reported Ethnicity -
0Unknown/Not Reported Ethnicity
@@ -1950,907 +1746,393 @@

2.2 Apply Map to Observed Dataset knitr::kable(ds_summary_long, caption = "Counts of Each Subgroup") - + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
-Counts of Each Subgroup -Counts of Each Subgroup
-gender - -race - -ethnicity - -n -
genderraceethnicityn
-Female - -American Indian/Alaska Native - -Not Hispanic or Latino - -1 -
-Female - -American Indian/Alaska Native - -Hispanic or Latino - -8 -
-Female - -American Indian/Alaska Native - -Unknown/Not Reported Ethnicity - -0 -
-Female - -Asian - -Not Hispanic or Latino - -0 -
-Female - -Asian - -Hispanic or Latino - -0 -
-Female - -Asian - -Unknown/Not Reported Ethnicity - -0 -
-Female - -Native Hawaiian or Other Pacific Islander - -Not Hispanic or Latino - -1 -
-Female - -Native Hawaiian or Other Pacific Islander - -Hispanic or Latino - -28 -
-Female - -Native Hawaiian or Other Pacific Islander - -Unknown/Not Reported Ethnicity - -3 -
-Female - -Black or African American - -Not Hispanic or Latino - -1 -
-Female - -Black or African American - -Hispanic or Latino - -172 -
-Female - -Black or African American - -Unknown/Not Reported Ethnicity - -14 -
-Female - -White - -Not Hispanic or Latino - -1 -
-Female - -White - -Hispanic or Latino - -22 -
-Female - -White - -Unknown/Not Reported Ethnicity - -2 -
-Female - -More than One Race - -Not Hispanic or Latino - -0 -
-Female - -More than One Race - -Hispanic or Latino - -0 -
-Female - -More than One Race - -Unknown/Not Reported Ethnicity - -0 -
-Female - -Unknown or Not Reported - -Not Hispanic or Latino - -0 -
-Female - -Unknown or Not Reported - -Hispanic or Latino - -7 -
-Female - -Unknown or Not Reported - -Unknown/Not Reported Ethnicity - -0 -
-Male - -American Indian/Alaska Native - -Not Hispanic or Latino - -0 -
-Male - -American Indian/Alaska Native - -Hispanic or Latino - -10 -
-Male - -American Indian/Alaska Native - -Unknown/Not Reported Ethnicity - -0 -
-Male - -Asian - -Not Hispanic or Latino - -0 -
-Male - -Asian - -Hispanic or Latino - -0 -
-Male - -Asian - -Unknown/Not Reported Ethnicity - -0 -
-Male - -Native Hawaiian or Other Pacific Islander - -Not Hispanic or Latino - -1 -
-Male - -Native Hawaiian or Other Pacific Islander - -Hispanic or Latino - -22 -
-Male - -Native Hawaiian or Other Pacific Islander - -Unknown/Not Reported Ethnicity - -1 -
-Male - -Black or African American - -Not Hispanic or Latino - -5 -
-Male - -Black or African American - -Hispanic or Latino - -154 -
-Male - -Black or African American - -Unknown/Not Reported Ethnicity - -6 -
-Male - -White - -Not Hispanic or Latino - -0 -
-Male - -White - -Hispanic or Latino - -33 -
-Male - -White - -Unknown/Not Reported Ethnicity - -1 -
-Male - -More than One Race - -Not Hispanic or Latino - -0 -
-Male - -More than One Race - -Hispanic or Latino - -0 -
-Male - -More than One Race - -Unknown/Not Reported Ethnicity - -0 -
-Male - -Unknown or Not Reported - -Not Hispanic or Latino - -0 -
-Male - -Unknown or Not Reported - -Hispanic or Latino - -7 -
-Male - -Unknown or Not Reported - -Unknown/Not Reported Ethnicity - -0 -
-Unknown/Not Reported - -American Indian/Alaska Native - -Not Hispanic or Latino - -0 -
-Unknown/Not Reported - -American Indian/Alaska Native - -Hispanic or Latino - -0 -
-Unknown/Not Reported - -American Indian/Alaska Native - -Unknown/Not Reported Ethnicity - -0 -
-Unknown/Not Reported - -Asian - -Not Hispanic or Latino - -0 -
-Unknown/Not Reported - -Asian - -Hispanic or Latino - -0 -
-Unknown/Not Reported - -Asian - -Unknown/Not Reported Ethnicity - -0 -
-Unknown/Not Reported - -Native Hawaiian or Other Pacific Islander - -Not Hispanic or Latino - -0 -
-Unknown/Not Reported - -Native Hawaiian or Other Pacific Islander - -Hispanic or Latino - -0 -
-Unknown/Not Reported - -Native Hawaiian or Other Pacific Islander - -Unknown/Not Reported Ethnicity - -0 -
-Unknown/Not Reported - -Black or African American - -Not Hispanic or Latino - -0 -
-Unknown/Not Reported - -Black or African American - -Hispanic or Latino - -0 -
-Unknown/Not Reported - -Black or African American - -Unknown/Not Reported Ethnicity - -0 -
-Unknown/Not Reported - -White - -Not Hispanic or Latino - -0 -
-Unknown/Not Reported - -White - -Hispanic or Latino - -0 -
-Unknown/Not Reported - -White - -Unknown/Not Reported Ethnicity - -0 -
-Unknown/Not Reported - -More than One Race - -Not Hispanic or Latino - -0 -
-Unknown/Not Reported - -More than One Race - -Hispanic or Latino - -0 -
-Unknown/Not Reported - -More than One Race - -Unknown/Not Reported Ethnicity - -0 -
-Unknown/Not Reported - -Unknown or Not Reported - -Not Hispanic or Latino - -0 -
-Unknown/Not Reported - -Unknown or Not Reported - -Hispanic or Latino - -0 -
-Unknown/Not Reported - -Unknown or Not Reported - -Unknown/Not Reported Ethnicity - -0 -
FemaleAmerican Indian/Alaska NativeNot Hispanic or Latino1
FemaleAmerican Indian/Alaska NativeHispanic or Latino8
FemaleAmerican Indian/Alaska NativeUnknown/Not Reported Ethnicity0
FemaleAsianNot Hispanic or Latino0
FemaleAsianHispanic or Latino0
FemaleAsianUnknown/Not Reported Ethnicity0
FemaleNative Hawaiian or Other Pacific IslanderNot Hispanic or Latino1
FemaleNative Hawaiian or Other Pacific IslanderHispanic or Latino28
FemaleNative Hawaiian or Other Pacific IslanderUnknown/Not Reported Ethnicity3
FemaleBlack or African AmericanNot Hispanic or Latino1
FemaleBlack or African AmericanHispanic or Latino172
FemaleBlack or African AmericanUnknown/Not Reported Ethnicity14
FemaleWhiteNot Hispanic or Latino1
FemaleWhiteHispanic or Latino22
FemaleWhiteUnknown/Not Reported Ethnicity2
FemaleMore than One RaceNot Hispanic or Latino0
FemaleMore than One RaceHispanic or Latino0
FemaleMore than One RaceUnknown/Not Reported Ethnicity0
FemaleUnknown or Not ReportedNot Hispanic or Latino0
FemaleUnknown or Not ReportedHispanic or Latino7
FemaleUnknown or Not ReportedUnknown/Not Reported Ethnicity0
MaleAmerican Indian/Alaska NativeNot Hispanic or Latino0
MaleAmerican Indian/Alaska NativeHispanic or Latino10
MaleAmerican Indian/Alaska NativeUnknown/Not Reported Ethnicity0
MaleAsianNot Hispanic or Latino0
MaleAsianHispanic or Latino0
MaleAsianUnknown/Not Reported Ethnicity0
MaleNative Hawaiian or Other Pacific IslanderNot Hispanic or Latino1
MaleNative Hawaiian or Other Pacific IslanderHispanic or Latino22
MaleNative Hawaiian or Other Pacific IslanderUnknown/Not Reported Ethnicity1
MaleBlack or African AmericanNot Hispanic or Latino5
MaleBlack or African AmericanHispanic or Latino154
MaleBlack or African AmericanUnknown/Not Reported Ethnicity6
MaleWhiteNot Hispanic or Latino0
MaleWhiteHispanic or Latino33
MaleWhiteUnknown/Not Reported Ethnicity1
MaleMore than One RaceNot Hispanic or Latino0
MaleMore than One RaceHispanic or Latino0
MaleMore than One RaceUnknown/Not Reported Ethnicity0
MaleUnknown or Not ReportedNot Hispanic or Latino0
MaleUnknown or Not ReportedHispanic or Latino7
MaleUnknown or Not ReportedUnknown/Not Reported Ethnicity0
Unknown/Not ReportedAmerican Indian/Alaska NativeNot Hispanic or Latino0
Unknown/Not ReportedAmerican Indian/Alaska NativeHispanic or Latino0
Unknown/Not ReportedAmerican Indian/Alaska NativeUnknown/Not Reported Ethnicity0
Unknown/Not ReportedAsianNot Hispanic or Latino0
Unknown/Not ReportedAsianHispanic or Latino0
Unknown/Not ReportedAsianUnknown/Not Reported Ethnicity0
Unknown/Not ReportedNative Hawaiian or Other Pacific IslanderNot Hispanic or Latino0
Unknown/Not ReportedNative Hawaiian or Other Pacific IslanderHispanic or Latino0
Unknown/Not ReportedNative Hawaiian or Other Pacific IslanderUnknown/Not Reported Ethnicity0
Unknown/Not ReportedBlack or African AmericanNot Hispanic or Latino0
Unknown/Not ReportedBlack or African AmericanHispanic or Latino0
Unknown/Not ReportedBlack or African AmericanUnknown/Not Reported Ethnicity0
Unknown/Not ReportedWhiteNot Hispanic or Latino0
Unknown/Not ReportedWhiteHispanic or Latino0
Unknown/Not ReportedWhiteUnknown/Not Reported Ethnicity0
Unknown/Not ReportedMore than One RaceNot Hispanic or Latino0
Unknown/Not ReportedMore than One RaceHispanic or Latino0
Unknown/Not ReportedMore than One RaceUnknown/Not Reported Ethnicity0
Unknown/Not ReportedUnknown or Not ReportedNot Hispanic or Latino0
Unknown/Not ReportedUnknown or Not ReportedHispanic or Latino0
Unknown/Not ReportedUnknown or Not ReportedUnknown/Not Reported Ethnicity0
@@ -3165,13 +2447,34 @@

3.1 Establish Datasets

devtools::install_github("OuhscBbmc/REDCapR") library(REDCapR) -

Next, download the data from the REDCap database into the ds_2 data.frame.

+

Next, download the data from the REDCap database into the ds_2 data.frame. If you’re running the most recent version of REDCapR (available on GitHub), the code will be:

ds_2 <- REDCapR::redcap_read_oneshot(
   redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/",  # URL of REDCap Server.
-  token      = "F304DEC3793FECC3B6DEEFF66302CAD3",    # User-speciifc token/password.
+  token      = "F304DEC3793FECC3B6DEEFF66302CAD3",    # User-specific token/password.
   guess_type = FALSE                                  # Keep all variables as strings/characters.
-)$data
-
## 500 records and 13 columns were read from REDCap in 0.7 seconds.  The http status code was 200.
+)$data +

The following code is more complicated than normal, because the vignette has to account for different versions of REDCapR being installed on the machine.

+
if( !requireNamespace("REDCapR", quietly=TRUE) ) {
+  ds <- ds_2 # If REDCapR isn't installed, use the previous version of the dataset.
+} else if( "0.9.8" < packageVersion("REDCapR") ) {
+  ds_2 <- REDCapR::redcap_read_oneshot(
+    redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/",  # URL of REDCap Server.
+    token      = "F304DEC3793FECC3B6DEEFF66302CAD3",    # User-specific token/password.
+    guess_type = FALSE                                  # Keep all variables as strings/characters.
+  )$data  
+} else {
+  # Older versions of REDCapR don't have the `guess_type` parameter
+  ds_2 <- REDCapR::redcap_read_oneshot(
+    redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/",  # URL of REDCap Server.
+    token      = "F304DEC3793FECC3B6DEEFF66302CAD3"     # User-specific token/password.
+  )$data %>% 
+    dplyr::mutate(
+      gender      = as.character(gender),
+      race        = as.character(race),
+      ethnicity   = as.character(ethnicity)
+    )
+}
+
## 500 records and 13 columns were read from REDCap in 0.8 seconds.  The http status code was 200.

3.2 Conform to NIH Cosmetics

diff --git a/man/codified-package.Rd b/man/codified-package.Rd index 06ca3f3..6a3deab 100644 --- a/man/codified-package.Rd +++ b/man/codified-package.Rd @@ -4,7 +4,7 @@ \name{codified-package} \alias{codified} \alias{codified-package} -\title{codified: Produce standard/formalized demographics tables} +\title{codified: Produce Standard/Formalized Demographics Tables} \description{ Augment clinical data with metadata to create output used in conventional publications and reports. @@ -12,6 +12,7 @@ Augment clinical data with metadata to create \seealso{ Useful links: \itemize{ + \item \url{https://ouhscbbmc.github.io/codified/} \item \url{https://github.com/OuhscBbmc/codified} \item \url{https://github.com/higgi13425/nih_enrollment_table} \item Report bugs at \url{https://github.com/OuhscBbmc/codified/issues} diff --git a/man/table_nih_enrollment.Rd b/man/table_nih_enrollment.Rd index 81f76f2..3ee3b30 100644 --- a/man/table_nih_enrollment.Rd +++ b/man/table_nih_enrollment.Rd @@ -3,7 +3,7 @@ \name{table_nih_enrollment} \alias{table_nih_enrollment} \alias{table_nih_enrollment_pretty} -\title{Produce an NIH-compliant enrolment table.} +\title{Produce an NIH-compliant enrollment table.} \usage{ table_nih_enrollment(d, d_lu_gender = NULL, d_lu_race = NULL, d_lu_ethnicity = NULL, variable_gender = "gender", diff --git a/vignettes/nih-enrollment-html.Rmd b/vignettes/nih-enrollment-html.Rmd index 7470fc9..c87a0df 100644 --- a/vignettes/nih-enrollment-html.Rmd +++ b/vignettes/nih-enrollment-html.Rmd @@ -135,14 +135,38 @@ if( !requireNamespace("REDCapR", quietly=T) ) library(REDCapR) ``` -Next, download the data from the REDCap database into the `ds_2` data.frame. +Next, download the data from the REDCap database into the `ds_2` data.frame. If you're running the most recent version of REDCapR (available on GitHub), the code will be: -```{r redcap-establish} +```r ds_2 <- REDCapR::redcap_read_oneshot( redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/", # URL of REDCap Server. - token = "F304DEC3793FECC3B6DEEFF66302CAD3", # User-speciifc token/password. + token = "F304DEC3793FECC3B6DEEFF66302CAD3", # User-specific token/password. guess_type = FALSE # Keep all variables as strings/characters. -)$data +)$data +``` +The following code is more complicated than normal, because the vignette has to account for different versions of REDCapR being installed on the machine. + +```{r redcap-establish} +if( !requireNamespace("REDCapR", quietly=TRUE) ) { + ds <- ds_2 # If REDCapR isn't installed, use the previous version of the dataset. +} else if( "0.9.8" < packageVersion("REDCapR") ) { + ds_2 <- REDCapR::redcap_read_oneshot( + redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/", # URL of REDCap Server. + token = "F304DEC3793FECC3B6DEEFF66302CAD3", # User-specific token/password. + guess_type = FALSE # Keep all variables as strings/characters. + )$data +} else { + # Older versions of REDCapR don't have the `guess_type` parameter + ds_2 <- REDCapR::redcap_read_oneshot( + redcap_uri = "https://bbmc.ouhsc.edu/redcap/api/", # URL of REDCap Server. + token = "F304DEC3793FECC3B6DEEFF66302CAD3" # User-specific token/password. + )$data %>% + dplyr::mutate( + gender = as.character(gender), + race = as.character(race), + ethnicity = as.character(ethnicity) + ) +} ``` @@ -195,8 +219,8 @@ table_nih_enrollment_pretty( d = ds_3, d_lu_race = ds_lu_race_3 ) - ``` + Feedback Welcome =====================================================