R/init_state_lookup.R

Defines functions init_state_lookup

Documented in init_state_lookup

#' Insert a lookup table to map subjects at risk for each transition to the appropriate rate code label 
#'
#' @inheritParams simulate_epimodel 
#'
#' @return character vector for mapping state codes to compartment names.
#' @export

init_state_lookup <- function(epimodel) {
          
          # matrix to map the state code to the compartment count
          state_lookup <- rep(0, nrow(epimodel$flow))
          for(k in 1:length(state_lookup)) {
                    state_lookup[k] <- colnames(epimodel$flow)[which(epimodel$flow[k,]==-1)]
          }
          
          return(state_lookup)
}
fintzij/BDAepimodel documentation built on Sept. 20, 2020, 1:44 p.m.