R/chmi.l_traits.units_ranges.R

Defines functions chmi.l_traits.units_ranges

#-----------------------------
# Range & units in CHMI Study
#-----------------------------

#' @export
chmi.l_traits.units_ranges <- function(traits)
{
  ### pre-defined data
  covlist <- list(

    # chmi.l_traits.pid()
    t_point =	c('[t_point] in days'),
    isotype_igg = c('[isotype_igg] IgG, IgG1, IgG2, IgG3, IgG4 or IgM'),
    malaria = c('[malaria] presence, absence'),
    ppp_time = c('[ppp_time] in days'),
    pcr_pos = c('[ppp_time] in days'),
    immune_status = c('[imune_status] placebo, 12800, 3200 or 51200'),
    status = c('[status] naive, semi_immune or vaccinated'),
    pcr_pos_pid = c('[ppp_pos_pid] in days'),
    mal_pos_qpcr = c('[mal_pos_qpcr] presence, absence'),
    height = c('[height] in centimetres'),
    weight = c('[weight] in centimetres'),

	 # chmi.l_traits.covars()
   hb_status = c('[gr_status] AA or AS'),
   gr_hbs = c('[gr_hbs] naive, AA or AS'),
	 t2_point = c('[t2_point] in days'),
   gr2_hbs = c('[gr2_hbs] naive or A_'),

	 # chmi.l_traits.mfi()
     mfi = c('[mfi] unit of fluorescence'),
     log10_mfi = c('[log10_mfi] unit of fluorescence'))

  ### select traits
    if(!missing(traits)) {
      stopifnot(all(traits %in% names(covlist)))
      covlist <- covlist[[traits]]

  ### case of a single trait
    if(length(traits)) {
    covlist <- unlist(covlist)
    }
  }
  return(covlist)
}
mvazquezs/chmitools documentation built on March 16, 2019, 10:08 a.m.