This function reads in all repetitions for each patch and calculates either the mean, quantiles, or both. User chooses the quantiles, up to 4 decimal places, and enters them as a vector. Quantiles are calculated empirically. (order does not matter)

calcQuantiles(readDir, writeDir, mean = TRUE, quantiles = NULL, verbose = TRUE)

Arguments

readDir

Directory to find repetition folders in

writeDir

Directory to write output

mean

Boolean, calculate mean or not. Default is TRUE

quantiles

Vector of quantiles to calculate. Default is NULL

verbose

Chatty? Default is TRUE

Value

Writes output to files in writeDir

Details

Given the readDir, this function assumes the follow file structure:

  • readDir

    • repetition 1

      • patch 1

      • patch 2

      • patch 3

    • repetition 2

      • patch 1

      • patch 2

      • patch 3

    • repetition 3

    • repetition 4

    • ...

Output files are *.csv contain the mean or quantile in the file name, i.e. M/FMean(patchNum).csv and M/FQuantile(quantNum)_(patchNum).csv.

Examples

# NOT RUN {
# This function assumes network$multRun() has been performed, or several
#  network$oneRun() have been performed and all of the data has been split
#  and aggregated.

# read/write paths
fPath <- "path/to/folder/ofFolders/with/data"
oPath <- "my/path/output"

# here, only calculate mean, no quantiles
#  no return value
calcQuantiles(readDir = fPath, writeDir = oPath, mean = TRUE,
              quantiles = NULL)

# here, calculate 2.5% and 97.5% quantiles
calcQuantiles(readDir = fPath, writeDir = oPath, mean = FALSE,
              quantiles = c(0.025, 0.975))
# }