Description Usage Arguments Details Value Examples
View source: R/data_handling.R
collate_dat
collates all Vortex output files matching a given project
name (and scenario name when relevant) in a given directory into one
data.frame using collate_one_dat
.
1 2 3 4 5 6 7 8 9 | collate_dat(
project,
runs,
scenario = NULL,
dir_in = NULL,
save2disk = TRUE,
dir_out = "ProcessedData",
verbose = TRUE
)
|
project |
The Vortex project name to be imported |
runs |
The number of Vortex simulation runs |
scenario |
The scenario name if ST, default: NULL |
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 |
The number of Vortex simulation runs has to be specified, as it cannot be inferred by vortexR.
To read Vortex output files from Sensitivity Testing with the extension
'.stdat', specify the scenario name. If scenario=NULL
, all files with
extension .dat, matching the project name will be imported.
dir_in
may contain other files; only files matching the project (and,
optionally, 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.
a data.frame with data from all matching Vortex files or NULL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Using Campbell et al. and Pacioni et al. example files.
# See ?pacioni and ?campbell for more details on example files.
require(vortexRdata)
camp.dir <- system.file('extdata', 'campbell', package='vortexRdata')
pac.dir <- system.file('extdata', 'pacioni', package='vortexRdata')
# Campbell example, project 'Starlingv3PopBased' (.dat)
starling <- collate_dat('Starlingv3PopBased', 10000,
dir_in=camp.dir, save2disk=FALSE)
# Read data from all .stdat of the project 'Pacioni_et_al' and the ST scenario
# 'ST_Classic' and store the output in the object 'woylie.st.classic'
woylie.st.classic <- collate_dat('Pacioni_et_al', 3, scenario = 'ST_Classic',
dir_in = pac.dir, save2disk=FALSE)
# Save collated data as .Rda and .txt
## Not run:
# Read data from all .stdat of the project 'Pacioni_et_al' and the ST scenario
# 'ST_Classic'. Store the output in the object 'woylie.st.classic' and save
# to disk
woylie.st.classic <- collate_dat('Pacioni_et_al', 3, scenario = 'ST_Classic',
dir_in = pac.dir, save2disk=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.