Skip to content

Commit 4c6b05f

Browse files
authored
Merge pull request #64 from mitre/main
Merging version 2.0, see NEWS.md for details.
2 parents f533d77 + 8e2199b commit 4c6b05f

File tree

99 files changed

+96871
-60930
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+96871
-60930
lines changed

.Rbuildignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ Dockerfile
1111
^README\.Rmd$
1212
^\.github$
1313
^\.lintr$
14+
^_pkgdown\.yml$
15+
^docs$
16+
^pkgdown$

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ inst/doc
4343
packrat/lib*/
4444
packrat/src/
4545

46+
*.swo
4647
*.swp
4748
output
4849
.Rproj.user
4950
.Rprofile
51+
docs/reference/*.csv
52+
docs/reference/*.log

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: growthcleanr
22
Type: Package
33
Title: Growth Measurements Cleaner
4-
Version: 1.2.5
4+
Version: 2.0.0
55
Authors@R: c(
66
person("Daymont","Carrie",,"[email protected]",c("aut","cre")),
77
person("Grundmeier","Robert",,"[email protected]","aut"),

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 Carrie Daymont
3+
Copyright (c) 2018-2021 Carrie Daymont
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

NAMESPACE

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export(longwide)
99
export(read_anthro)
1010
export(recode_sex)
1111
export(sd_median)
12+
export(simple_bmi)
1213
export(splitinput)
1314
import(data.table)
1415
import(doParallel)
@@ -19,3 +20,12 @@ import(magrittr)
1920
import(parallel)
2021
import(plyr, except = c(failwith, id, summarize, count, desc, mutate, arrange, rename, is.discrete, summarise, summarize))
2122
import(tidyr, except = extract)
23+
importFrom(stats,approx)
24+
importFrom(stats,median)
25+
importFrom(stats,pnorm)
26+
importFrom(stats,qnorm)
27+
importFrom(stats,setNames)
28+
importFrom(utils,read.csv)
29+
importFrom(utils,read.table)
30+
importFrom(utils,tail)
31+
importFrom(utils,write.csv)

NEWS.md

Lines changed: 63 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,41 @@
1-
# growthcleanr
1+
# growthcleanr 2.0.0 - 2021-06-30
22

3-
## [1.2.6] - 2021-06-10
3+
## Added
44

5-
### Changed
5+
- Support for cleaning adult (18-65) observations with `adult_cutpoint` and
6+
`weightcap` options (https://github.com/mitre/growthcleanr/pull/17, others)
7+
- Added documentation describing adult algorithm, examples, and exclusions
8+
(#30), next steps (#63)
9+
- Added tests supporting adult observations (#49)
10+
11+
## Changed
12+
13+
- Removed BMI calculation from `longwide()`, added `simple_bmi()` (#47)
14+
- Enhanced `gcdriver.R` to support adult options, parallel operation
15+
(https://github.com/mitre/growthcleanr/pull/23)
16+
- Refreshed `syngrowth` synthetic test data, now includes adults (#50)
17+
- Reorganized documentation from README, now using
18+
[pkgdown](https://pkgdown.r-lib.org/) (#30)
19+
- Improved code layout to pass `CHECK` cleanly (#18, #60)
20+
21+
# growthcleanr 1.2.6 - 2021-06-10
22+
23+
## Changed
624

725
- Corrected four duplicated age-rows in NHANES reference medians (#40)
826
- Added missing non-newborn constraint in 14h.ii (thanks Lusha Cao)
927
- Removed `Hmisc` dependency (#36)
1028
- Replaced `clean_value` result column name in docs with `gcr_result` for
1129
clarity (#35)
1230

13-
## [1.2.5] - 2021-02-26
31+
# growthcleanr 1.2.5 - 2021-02-26
32+
33+
## Added
34+
35+
- Added `inst/extdata/nhanes-reference-medians.csv`, reference medians for
36+
recentering derived from NHANES (described in README)
1437

15-
### Changed
38+
## Changed
1639

1740
- Updated behavior of `sd.recenter` option to include new NHANES reference
1841
medians and explicit specification with "NHANES" or "derive"
@@ -21,24 +44,36 @@
2144
@mcanouil) (#17)
2245
- Switched to use `file.path()` more consistently in `R/growth.R`
2346

24-
### Added
47+
# growthcleanr 1.2.4 - 2021-01-14
2548

26-
- Added `inst/extdata/nhanes-reference-medians.csv`, reference medians for
27-
recentering derived from NHANES (described in README)
49+
## Changed
50+
51+
- Minor update to WHO HT velocity 3SD files to correct a small number of errors
52+
(#24). Affected files were:
53+
54+
- `inst/extdata/who_ht_maxvel_3sd.csv`
55+
- `inst/extdata/who_ht_vel_3sd.csv`
2856

29-
## [1.2.4] - 2021-01-14
57+
Although these changes were very minor, it is possible that results on data
58+
cleaned after this change may vary from previous results. The prior version of
59+
these files may be obtained by visiting the tagged release version 1.2.3 at
60+
https://github.com/carriedaymont/growthcleanr/releases/tag/1.2.3.
3061

31-
### Changed
62+
The released version of `growthcleanr` available at that link contains the
63+
older version of both files; that older version may be used to verify
64+
reproducibility.
3265

33-
- Minor update to WHO HT velocity 3SD files (#24)
66+
Alternatively, a more recent version of `growthcleanr` may be used with only
67+
the affected files replaced with their older versions available at the 1.2.3
68+
tag link above. This must be done manually.
3469

35-
## [1.2.3] - 2021-01-07
70+
# growthcleanr 1.2.3 - 2021-01-07
3671

37-
### Added
72+
## Added
3873

3974
- New exclusion handling option on experimental carry forward adjustment
4075

41-
### Changed
76+
## Changed
4277

4378
- Improved experimental carry forward adjustment handling of strings of
4479
CF values, output handling, and documentation; renamed "Missing" values
@@ -49,13 +84,13 @@
4984
- Improved Dockerfile to standardize user/path, simplify install (thanks
5085
@mcanouil)
5186

52-
## [1.2.2] - 2020-09-29
87+
# growthcleanr 1.2.2 - 2020-09-29
5388

54-
### Added
89+
## Added
5590

5691
- CITATION file, now `citation("growthcleanr")` works as expected
5792

58-
### Changed
93+
## Changed
5994

6095
- Standardized on arrow assignment
6196
- Moved functions previously within other functions to top level
@@ -70,20 +105,20 @@
70105
- Improved and corrected documentation
71106
- Re-compressed synthetic sample data (`syngrowth`) to improve compression
72107

73-
## [1.2.1] - 2020-08-14
108+
# growthcleanr 1.2.1 - 2020-08-14
74109

75-
### Added
110+
## Added
76111

77112
- New tests in `tests/testthat/test-utils.R` and `tests/testthat/test-cdc.R`
78113
to support newly added functions
79114

80-
### Changed
115+
## Changed
81116

82117
- Improved error handling in `longwide()`; fixed missing import in DESCRIPTION
83118

84-
## [1.2] - 2020-07-24
119+
# growthcleanr 1.2 - 2020-07-24
85120

86-
### Added
121+
## Added
87122

88123
- New CDC BMI calculation function `ext_bmiz()`, comparable to SAS program
89124
published at https://www.cdc.gov/nccdphp/dnpao/growthcharts/resources/sas.htm
@@ -101,16 +136,16 @@
101136
and driver script `exec/testadjustcf.R` (see README-adjustcarryforward.md for
102137
details)
103138

104-
### Changed
139+
## Changed
105140

106141
- Reorganized code from `R/growth.R` into separate files for clarity and easier
107142
maintenance (all utility functions not directly used by `cleangrowth()` are
108143
now in `R/utils.R`)
109144
- Updated README with details and examples for added functions
110145

111-
## [1.1] - 2020-02-07
146+
# growthcleanr 1.1 - 2020-02-07
112147

113-
### Added
148+
## Added
114149

115150
- New options to add flexibility:
116151
- `error.load.mincount` and `error.load.threshold`
@@ -120,16 +155,16 @@
120155
- New `splitinput()` function
121156
- New example synthetic data set `syngrowth` loads automatically.
122157

123-
### Changed
158+
## Changed
124159

125160
- Several updates to improve performance, including eliminating use of
126161
data.table in ewma function.
127162
- Updated README with link to paper, detailed introduction, more installation
128163
details, examples, notes on handling large datasets, lists of parameters
129164
and exclusions.
130165

131-
## [1.0.0] - 2018-09-11
166+
# growthcleanr 1.0.0 - 2018-09-11
132167

133-
### Added
168+
## Added
134169

135170
- Initial version posted to GitHub.

R/adjustcarryforward.R

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ calc_temp_exclusion_15 <- function(
1515
ewma.fields, tanner.ht.vel, who.ht.vel, exclude.levels,
1616
ewma.exp, minfactor, maxfactor, banddiff, banddiff_plus,
1717
min_ht.exp_under, min_ht.exp_over, max_ht.exp_under, max_ht.exp_over){
18+
19+
# avoid "no visible binding" warnings
20+
abs.tbc.sd <- abs.tbc.sd.next <- abs.tbc.sd.prev <- aft.g.befp1 <- NULL
21+
agedays <- agedays.next <- bef.g.aftm1 <- delta.agedays.next <- NULL
22+
delta.next.ht <- delta.prev.ht <- dewma.after <- dewma.after.prev <- NULL
23+
dewma.before <- dewma.before.next <- ewma.after <- ewma.all <- ewma.before <- NULL
24+
ht.exp <- index <- max.ht.vel <- max.whoinc.1.ht <- max.whoinc.2.ht <- max.whoinc.3.ht <- NULL
25+
max.whoinc.4.ht <- max.whoinc.6.ht <- maxdiff.next.ht <- maxdiff.prev.ht <- NULL
26+
mid.agedays <- min.ht.vel <- mindiff.next.ht <- mindiff.prev.ht <- pair <- NULL
27+
pair.next <- pair.prev <- sex <- tanner.months <- tbc.sd <- temp.diff <- temp.exclude <- NULL
28+
v <- v.next <- v.prev <- who.maxdiff.next.ht <- who.mindiff.next.ht <- whoagegrp.ht <- NULL
29+
whoinc.1.ht <- whoinc.2.ht <- whoinc.3.ht <- whoinc.4.ht <- whoinc.6.ht <- NULL
30+
whoinc.age.ht <- NULL
31+
32+
1833
# initialize fields
1934
df[, (ewma.fields) := as.double(NaN)]
2035
df[, `:=`(
@@ -374,6 +389,18 @@ calc_step_15_no_param <- function(
374389
ewma.fields, tanner.ht.vel, who.ht.vel, exclude.levels,
375390
ewma.exp){
376391

392+
# avoid "no visible binding for global variable" warnings
393+
agedays <- tbc.sd <- ewma.all <- ewma.before <- ewma.after <- v <- dewma.before <- NULL
394+
abs.tbc.sd <- sex <- tanner.months <- ht.exp <- delta.agedays.next <- mindiff.next.ht <- NULL
395+
min.ht.vel <- maxdiff.next.ht <- max.ht.vel <- minhtvel.exp <- min.ht.vel.2sd <- NULL
396+
max.ht.vel.2sd <- whoagegrp.ht <- whoinc.age.ht <- index <- who.mindiff.next.ht <- NULL
397+
whoinc.1.ht <- whoinc.2.ht <- whoinc.3.ht <- whoinc.4.ht <- whoinc.6.ht <- NULL
398+
who.maxdiff.next.ht <- max.whoinc.1.ht <- max.whoinc.2.ht <- max.whoinc.3.ht <- NULL
399+
max.whoinc.4.ht <- max.whoinc.6.ht <- dewma.after <- v.prev <- v.next <- pair <- NULL
400+
delta.prev.ht <- mindiff.prev.ht <- delta.next.ht <- maxdiff.prev.ht <- NULL
401+
dewma.after.prev <- pair.prev <- dewma.before.next <- pair.next <- temp.diff <- NULL
402+
bef.g.aftm1 <- aft.g.befp1 <- abs.tbc.sd.prev <- abs.tbc.sd.next <- temp.exclude <- NULL
403+
377404
# initialize fields
378405
df[, (ewma.fields) := as.double(NaN)]
379406
df[, `:=`(
@@ -743,6 +770,11 @@ acf_answers <- function(subjid,
743770
ewma.exp = -1.5,
744771
ref.data.path = "",
745772
quietly = T){
773+
774+
# avoid "no visible binding for global variable" warnings
775+
tanner.months <- whoagegrp_ht <- whoagegrp.ht <- z.orig <- z.orig <- v <- sd.orig <- NULL
776+
index <- exclude <- tbc.sd <- sd.median <- acf_answer <- NULL
777+
746778
# process ----
747779
# organize data into a dataframe along with a line "index" so the original data order can be recovered
748780
data.all <- data.table(
@@ -1088,6 +1120,20 @@ adjustcarryforward <- function(subjid,
10881120
min_ht.exp_over = 0,
10891121
max_ht.exp_under = 0.33,
10901122
max_ht.exp_over = 1.5) {
1123+
1124+
# Avoid "undefined global functions/variables" warnings
1125+
v <- sd.orig <- sd.median <- tbc.sd <- agedays.next <- mid.agedays <- min.ht.vel <- NULL
1126+
delta.agedays.next <- ht.exp <- max.ht.vel <- mindiff.next.ht <- temp.exclude <- NULL
1127+
ecf_tmp <- ewma.all <- ewma.before <- ewma.after <- abs.tbc.sd <- whoinc.1.ht <- NULL
1128+
whoinc.2.ht <- whoinc.3.ht <- whoinc.4.ht <- whoinc.6.ht <- max.whoinc.1.ht <- NULL
1129+
max.whoinc.2.ht <- max.whoinc.3.ht <- max.whoinc.4.ht <- max.whoinc.6.ht <- NULL
1130+
whoinc.age.ht <- whoinc.age.ht <- who.mindiff.next.ht <- who.maxdiff.next.ht <- NULL
1131+
dewma.after <- maxdiff.next.ht <- v.prev <- v.next <- delta.prev.ht <- NULL
1132+
mindiff.prev.ht <- delta.next.ht <- maxdiff.prev.ht <- pair <- dewma.after.prev <- NULL
1133+
pair.prev <- dewma.before.next <- pair.next <- bef.g.aftm1 <- aft.g.befp1 <- NULL
1134+
abs.tbc.sd.prev <- abs.tbc.sd.next <- exclude <- n <- dewma.before <- NULL
1135+
tanner.months <- whoagegrp_ht <- whoagegrp.ht <- z.orig <- index <- temp.diff <- NULL
1136+
10911137
# check option is valid
10921138
if (!exclude_opt %in% 0:3){
10931139
stop("Invalid exclude_opt. Enter a number from 0 to 3.")

0 commit comments

Comments
 (0)