R/modelJoin.R

Defines functions model.join

Documented in model.join

#' Joins all models into a joined tabular format
#'
#' @param m.mtn model generated by model.motion
#' @param m.dns model generated by model.density
#' @param m.mnp model generated by model.manipulation
#' @param m.lng model generated by model.longNote
#'
#' @importFrom magrittr %>%
#' @importFrom dplyr rename
#' @importFrom purrr reduce
#'
#' @export

model.join <- function(m.mtn, m.dns, m.mnp, m.lng, m.jck){
  # This joins all models
  model <- list(m.mtn, m.dns, m.mnp, m.lng, m.jck) %>%
    purrr::reduce(dplyr::left_join, by = 'offsets') %>%
    dplyr::rename(mtn.vals = 2,
                  dns.vals = 3,
                  mnp.vals = 4,
                  lng.vals = 5,
                  jck.vals = 6) %>%
    replace(is.na(.), 0)

  return(model)
}
Eve-ning/vsrgtools documentation built on Oct. 30, 2019, 5:40 p.m.