r4Casal2
2024-09-04
Chapter 1 Welcolme to r4Casal2
This book demonstrates functionality of the r4Casal2
R package. This is an R package that works with the Casal2
base R-library found here, although it is advised to use the R-library that is included with the Casal2 binary and usermanual you acquired. The Casal2
base R-library is responsible for reading in output and interacting with Casal2 configuration files. The r4Casal2
R package has been built for summarising and visualising objects read in from the base Casal2
R-library.
All functions in this package should be documented using the roxygen
syntax with input parameters available using the ?
query. For example ?get_fisheries
. To get a list of functions and general info on the package you can use library(help="r4Casal2")
or see Section 2 for another list
library(r4Casal2)
library(Casal2)
library(knitr)
library(ggplot2)
library(dplyr)
library(reshape2)
library(tidyr)
The core functionality of r4Casal2
are its accessor functions. These are functions that will return a specific object from a range of Casal2 objects in long format that are ggplot
, dplyr
friendly. Most accessors start with get_
and should be self explanatory. There are some plotting functions, but I have found that I often want to custom ggplots and so mainly have custom plots. The accessors are coded to deal with three types of outpus. These are;
extract.mpd()
where Casal2 has been run with default report style. These objects are of classcasal2MPD
which are set by the Casal2 base functionextract.mpd()
where Casal2 has been run with tabular reportscasal2 --tabular
orcasal2 -t
. These objects are of classcasal2TAB
which are set by the Casal2 base functionlist
this is a list ofcasal2MPD
which is a useful format for comparing MPD runs see Section 5