Skip to content

Commit

Permalink
Merge pull request #111 from generable/fix-performance-annotation
Browse files Browse the repository at this point in the history
fix-performance-annotation
  • Loading branch information
jburos authored Jul 4, 2023
2 parents ac5c549 + bb73fa7 commit d481497
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions R/geco_subjects.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,18 @@ fetch_subjects <- function(project = NULL, project_version_id = NULL, event_type
if (all(c('age_min', 'age_max') %in% names(s))) {
s <- s %>%
dplyr::mutate(age = (.data$age_min + .data$age_max) / 2)
} else if ('age_min' %in% names(s)) {
s <- s %>%
dplyr::mutate(age = .data$age_min)
}
if ('performance' %in% names(s)) {
s <- s %>%
dplyr::mutate(performance = factor(.data$performance, levels = c('fully_active', 'restricted_activity', 'self-care_only'), ordered = T))
if (all(unique(s$performance) %in% c('fully_active', 'restricted_activity', 'self-care_only'))) {
s <- s %>%
dplyr::mutate(performance = factor(.data$performance, levels = c('fully_active', 'restricted_activity', 'self-care_only'), ordered = T))
} else if (all(is.na(as.integer(s$performance)) == is.na(s$performance))) {
s <- s %>%
dplyr::mutate(performance = as.integer(.data$performance))
}
}
if ('baseline_weight_min' %in% names(s)) {
s <- s %>%
Expand Down

0 comments on commit d481497

Please sign in to comment.