R/clean_cd4_vl.R

Defines functions clean_cd4_vl

Documented in clean_cd4_vl

#' @title Clean HIV CD4 and VL data
#'
#' Convert HIV VL binary variable a factor
#' @param x data frame from server with HIV VL and CD4 data
#'

clean_cd4_vl <- function(x) {
  
  # Check args ----
  assertthat::assert_that(is.data.frame(x))
  
  # Convert status change to factor ----
  x$hiv_vl_detect <-
    factor(x$hiv_vl_detect,
           levels = c("Detectable", "Undetectable"))
  
  x
  
}
JayAchar/hisreportr documentation built on March 18, 2020, 5:57 a.m.