collate_yr: Collate Vortex .yr output files

Description Usage Arguments Details Value Examples

View source: R/data_handling.R

Description

collate_yr collates all the .yr output from Vortex matching the project and scenario name into one R object and calculates the mean for each simulated year across all iterations.

Usage

1
2
3
4
5
6
7
8
9
collate_yr(
  project,
  scenario,
  npops_noMeta = 1,
  dir_in = NULL,
  save2disk = TRUE,
  dir_out = "ProcessedData",
  verbose = TRUE
)

Arguments

project

The Vortex project name to be imported

scenario

The scenario name, default: NULL

npops_noMeta

The total number of populations excluding the metapopulation, default: 1

dir_in

The local folder containing Vortex files, default: NULL. If not specified, will fall back to use current working directory.

save2disk

Whether to save the data as rda and csv, default: TRUE

dir_out

The local path to store the output. Default: ProcessedData

verbose

Progress messages, default: TRUE

Details

dir_in may contain other files; only files matching the project and the scenario name will be read.

dir_out is created within the working directory unless a full path is provided.

If no matching files are found in the given directory, an error is reported.

When verbose=TRUE the progress (i.e. the file being read) is reported on screen.

Value

a list with two elements: 'census', a data.frame with data from all Vortex files and 'census_means', a data.table with the mean of each parameter across all iterations for each simulated year

Examples

1
2
3
4
5
6
7
# Using Pacioni et al. example files. See ?pacioni for more details.
pac.dir <- system.file('extdata', 'pacioni', package='vortexRdata')

# Run collate_yr on all .yr of project 'Pacioni_et_al' and the ST scenario
# 'ST_Classic' in the selected folder and store the result in 'yr.st.classic'
yr.st.classic <- collate_yr(project='Pacioni_et_al', scenario='ST_Classic',
                            dir_in = pac.dir, save2disk=FALSE)

vortexR documentation built on April 14, 2020, 7:23 p.m.