R/read_collected_gammas_postrs.R

#' Read all the collected gamma statistics of all posteriors
#' @param filename name of the CSV file
#' @return a dataframe
#' @usage read_collected_gammas_postrs(
#'   filename = wiritttea::find_path("collect_files_posterior_gammas.csv"))
#' @examples
#'   df <- read_collected_gammas_postrs()
#'   testit::assert(names(df) ==
#'     c(
#'       "filename", "sti", "ai",
#'       "pi", "si", "gamma_stat"
#'     )
#'   )
#' @author Richel Bilderbeek
#' @export
read_collected_gammas_postrs <- function(
  filename = wiritttea::find_path("collect_files_posterior_gammas.csv")
) {
  testit::assert(file.exists(filename))
  df <- utils::read.csv(
   file = filename,
   header = TRUE,
   stringsAsFactors = FALSE,
   row.names = 1
  )
  df$filename <- as.factor(df$filename)
  df$sti <- as.factor(df$sti)
  df$ai <- as.factor(df$ai)
  df$pi <- as.factor(df$pi)
  df$si <- as.factor(df$si)
  df
}
richelbilderbeek/wiritttea documentation built on May 27, 2019, 8:02 a.m.