R/BuildDF.R

#' BuildDF
#'
#' For multiple run settings we pull in separate tibbles and combine to create MCMC summaries by simulation number and by runsetting.
#'
#' @param outext The output folder file path, no runname specified
#' @param runnames The run settings to include in the data frame.
#'
#' @return
#' @export
#'
#' @examples
#' BuildDF("./output/", c("runsetting1", "runsetting2"))

BuildDF <- function(outext, runnames){
  dflist <- list()
  dfnew <- list()
  for(j in 1:length(runnames)){
    dflist[[runnames[j]]] <-  readRDS(paste(outext,runnames[j] ,"/sumsetting_", runnames[j], ".RDS", sep=""))
    df <- readRDS(paste(outext,runnames[j] ,"/sumsetting_", runnames[j], ".RDS", sep=""))
    dfnew[[runnames[j]]] <-  df %>%
      filter(parameter %in% plotpars)
  }


  DFtot <- do.call("rbind", dflist)
  DFsubset <- do.call("rbind", dfnew)

  saveRDS(DFtot, paste(outext, "DFtot.RDS", sep=""))
  saveRDS(DFsubset, paste(outext, "DFsubset.RDS", sep=""))

  }
Enpeterson/outputsim documentation built on May 24, 2019, 9:53 a.m.