R/modify_code_given_certitude.R

#' modify_code_given_certitude
#' @export
modify_code_given_certitude <- function(concepts, neg) {
  require(dplyr, quietly = TRUE)
  
  if (neg) {
    concepts %>% 
      mutate(CODE = ifelse(CONCEPT_CERTITUDE == -1, paste0('no_',CODE), CODE),
             CODE_LABEL = ifelse(CONCEPT_CERTITUDE == -1, paste0('no_',CODE_LABEL), CODE_LABEL))
  } else {
    concepts %>% dplyr::filter(CONCEPT_CERTITUDE == 1)
  }
  
}
aneuraz/multiWAS documentation built on May 14, 2019, 2:37 p.m.