readTrace: Modified from RevGadgets

View source: R/readTrace.R

readTraceR Documentation

Modified from RevGadgets

Description

Read trace

Usage

readTrace(
  paths,
  format = "simple",
  delim,
  burnin = 0,
  check.names = FALSE,
  skip,
  ...
)

Arguments

paths

(vector of character strings; no default) File path(s) to trace file.

format

(single character string; default = simple) Indicates type of MCMC trace, complex indicates cases where trace contains vectors of vectors/ matrices - mnStochasticVariable monitor will sometimes be of this type.

delim

(single character string) Delimiter of file.

burnin

(single numeric value; default = 0.1) Fraction of generations to discard (if value provided is between 0 and 1) or number of generations (if value provided is greater than 1).

check.names

(logical; default = FALSE) Passed to utils::read.table(); indicates if utils::read.table() should check column names and replace syntactically invalid characters.

skip

Number of lines to skip before reading the data from the log file.

...

(various) Additional arguments passed to utils::read.table().

Details

Reads in MCMC log files

Reads in one or multiple MCMC log files from the same analysis and discards a user-specified burn-in, compatible with multiple monitor types. If the trace contains vectors of vectors and the user does not specify format = "complex", readTrace() will read in those columns as factors rather than as numeric vectors.

Value

List of dataframes (of length 1 if only 1 log file provided).

Examples


## Not run: 
file <- system.file("extdata",
    "sub_models/primates_cytb_covariotide.p", package="RevGadgets")
one_trace <- readTrace(paths = file)
multi_trace <- readTrace(paths = c(file, file))

## End(Not run)

lfabreti/convenience documentation built on June 17, 2022, 8:12 a.m.