R/m067.phen.class_update.R

Defines functions m067.def_class.dat_1

#------------------------
# Define class variables
#------------------------

# update class & relevel in 'dat_imp[[1]]'
m067.def_class.dat_1 <- function(dat_1)
{
  # class variables selected
    vars_f <- c('site', 'country', 'sid')
  # plyr transform
    dat_1[, vars_f] <- lapply(dat_1[, vars_f], as.factor)

    # relevels
    dat_1 <- within(dat_1, {
        t_point <- relevel(t_point, ref = 'M0')
        agec <- relevel(agec, ref = '6_12w')
        vaccine_t <- relevel(vaccine_t, ref = 'C3C')
        vaccine_t2 <- relevel(vaccine_t2, ref = 'comparator')
        cc_12 <- relevel(cc_12, ref = 'control')
        cc_18 <- relevel(cc_12, ref = 'control')
        })

  # return
  return(dat_1)
}
mvazquezs/m067tools documentation built on April 19, 2019, 7:07 p.m.