|
51 | 51 | #' # Checkout data ------------------------------------------------------------ |
52 | 52 | #' # Checkout census |
53 | 53 | #' head(data_SLAM_census) |
54 | | -#' |
| 54 | +#' |
55 | 55 | #' # Checkout glucose |
56 | 56 | #' head(data_SLAM_gluc) |
57 | | -#' |
| 57 | +#' |
58 | 58 | #' # Checkout nmr |
59 | 59 | #' head(data_SLAM_nmr) |
60 | | -#' |
| 60 | +#' |
61 | 61 | #' # Create gluc -------------------------------------------------------------- |
62 | 62 | #' # join glucose and census for dob and other infor |
63 | 63 | #' gluc <- dplyr::left_join(data_SLAM_gluc, data_SLAM_census, by = "idno") |
|
81 | 81 | #' age_wk = difftime(date, dob, units = "weeks"), |
82 | 82 | #' date = as.Date(date, "%m%d%Y") |
83 | 83 | #' ) |
84 | | -#' |
| 84 | +#' |
85 | 85 | #' # Create nmr --------------------------------------------------------------- |
86 | 86 | #' # join nmr with census for dob and other info |
87 | 87 | #' nmr <- dplyr::left_join(data_SLAM_nmr, data_SLAM_census, by = "idno") |
|
104 | 104 | #' age_wk = difftime(date, dob, units = "weeks"), |
105 | 105 | #' date = as.Date(date, "%m%d%Y") |
106 | 106 | #' ) |
107 | | -#' |
| 107 | +#' |
108 | 108 | #' # Use merge_diftime -------------------------------------------------------- |
109 | 109 | #' gluc_nmr <- merge_diftime( |
110 | 110 | #' data1 = gluc, |
|
114 | 114 | #' vars = c("bw", "lean", "fluid", "fat"), |
115 | 115 | #' clean_vars = FALSE |
116 | 116 | #' ) |
117 | | -#' |
| 117 | +#' |
118 | 118 | #' # Checkout results |
119 | 119 | #' head(gluc_nmr) |
120 | 120 | #' } else { |
@@ -201,7 +201,7 @@ merge_diftime <- function(data1, |
201 | 201 | } |
202 | 202 |
|
203 | 203 | data.table::setorderv(dtm, cols = c(id1, "dif_ef")) |
204 | | - |
| 204 | + |
205 | 205 | dtm <- base::unique(dtm, by = c(eval(id1), eval(age1))) |
206 | 206 |
|
207 | 207 | # threshold |
|
0 commit comments