calcQuantiles: Summary Statistics for Stochastic MGDrivE

Description Usage Arguments Details Value Examples

View source: R/MGDrivE-Auxiliary.R

Description

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)

Usage

1
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

Details

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

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.

Value

Writes output to files in writeDir

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## 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))

## End(Not run)

MGDrivE documentation built on Oct. 23, 2020, 7:28 p.m.