| Title: | R implementation of Ecopath with Ecosim |
|---|---|
| Description: | This package implements the core mass balance equations made popular by Ecopath with Ecosim. There are two parts to the package, the static snapshot of energy flow through the system using rpath and dynamic simulations run using the rsim family of functions. |
| Authors: | Kerim Aydin [aut, cre] (ORCID: <https://orcid.org/0000-0003-3792-9828>), Sean Lucey [aut] (ORCID: <https://orcid.org/0000-0001-6675-5500>), Sarah Gaichas [aut] (ORCID: <https://orcid.org/0000-0002-5788-3073>), Sarah Weisberg [aut] (ORCID: <https://orcid.org/0000-0003-4271-9534>), Andy Whitehouse [aut] (ORCID: <https://orcid.org/0000-0002-9130-9403>), Bia Dias [ctb] (ORCID: <https://orcid.org/0000-0001-5905-4044>), Ron Klasky [ctb], Andy Beet [ctb] (ORCID: <https://orcid.org/0000-0001-8270-7090>), Max Grezlik [ctb] |
| Maintainer: | Kerim Aydin <[email protected]> |
| License: | file LICENSE |
| Version: | 1.1.0 |
| Built: | 2026-06-07 07:50:15 UTC |
| Source: | https://github.com/NOAA-EDAB/Rpath |
Anchovy Bay (AB.params) is a sample ecosystem frequently used as an
example ecosystem with EwE (see Christensen and Walters, 2024).
AB.paramsAB.params
An unbalanced Rpath model object that contains:
A data.table containing Ecopath unbalanced ecosystem parameters (base parameters and fisheries).
A data.table containing the Ecopath model's diet matrix.
Parameters for multistanza groups.
A data.table containing the data quality (pedigree) for the Ecopath model.
...
Christensen V, Walters CJ (2024) Ecosystem Modelling with EwE. The University of British Columbia, Vancouver, BC. doi:10.14288/24d7-ab68
# Balance the model AB_bal <- rpath(AB.params)# Balance the model AB_bal <- rpath(AB.params)
Modifies the fishing mortality value for a species by a particular gear. Parameters that can be adjusted using this function are: ForcedEffort, ForcedFRate, or ForcedCatch.
adjust.fishing( Rsim.scenario, parameter, group = NA, sim.year = 1, sim.month = 0, value )adjust.fishing( Rsim.scenario, parameter, group = NA, sim.year = 1, sim.month = 0, value )
Rsim.scenario |
Scenario object that contains all of the rsim rates and
forcing functions generated by |
parameter |
Parameters to be modified ( |
group |
Name of the group whose parameter is being changed. Valid values are found in the 'Group' field of the object
created from running |
sim.year |
Year of the simulation that should be modified. Can be a range of years. |
sim.month |
Month of the year that should be modified. If set to 0, all months of the year are modified. |
value |
New value for the parameter. |
Returns an Rsim.scenario() object with the new fishing parameter
values.
Other Adjust functions:
adjust.forcing(),
adjust.scenario(),
set.rsim.scene()
# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Change value of forcedFRate for Squids in years 3 through 5 to the value of 2 (for all months) Rsim.scenario.adjusted.fishing <- adjust.fishing(Rsim.scenario, parameter = "ForcedFRate", group = "cod", sim.year = 3:5, value = 2) head(Rsim.scenario.adjusted.fishing$fishing$ForcedFRate)# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Change value of forcedFRate for Squids in years 3 through 5 to the value of 2 (for all months) Rsim.scenario.adjusted.fishing <- adjust.fishing(Rsim.scenario, parameter = "ForcedFRate", group = "cod", sim.year = 3:5, value = 2) head(Rsim.scenario.adjusted.fishing$fishing$ForcedFRate)
Modifies the various forcing parameters of the rsim scenario object.
adjust.forcing( Rsim.scenario, parameter, group, sim.year = 1, sim.month = 0, bymonth = F, value )adjust.forcing( Rsim.scenario, parameter, group, sim.year = 1, sim.month = 0, bymonth = F, value )
Rsim.scenario |
Scenario object that contains all of the rsim rates and
forcing functions generated by |
parameter |
Parameters to be modified ( |
group |
Name of the group whose parameter is being changed. Valid values are found in the 'Group' field of the object
created from running |
sim.year |
Year of the simulation that should be modified. Can be a range of years. |
sim.month |
Month of the year that should be modified. If set to 0, all months of the year are modified. |
bymonth |
Boolean value that denotes whether to use sim.year/sim.month combo or just sim.month as a sequential vector starting at 1. |
value |
New value for the parameter. |
Returns an Rsim.scenario object with the new parameter.
Other Adjust functions:
adjust.fishing(),
adjust.scenario(),
set.rsim.scene()
# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Adjust the ForcedPrey parameter for cod in year 1 for all months. Change the value to 10 Rsim.scenario.adjusted <- adjust.forcing(Rsim.scenario, parameter="ForcedPrey",group = "cod", sim.year = 1, sim.month=0,value=10) head(Rsim.scenario.adjusted$forcing$ForcedPrey)# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Adjust the ForcedPrey parameter for cod in year 1 for all months. Change the value to 10 Rsim.scenario.adjusted <- adjust.forcing(Rsim.scenario, parameter="ForcedPrey",group = "cod", sim.year = 1, sim.month=0,value=10) head(Rsim.scenario.adjusted$forcing$ForcedPrey)
Modifies the various parameters of the rsim.scenario() object. Parameters that can be adjusted using this function are:
B_BaseRef, MzeroMort,UnassimRespFrac, ActiveRespFrac, FtimeAdj,
FtimeQBOpt, PBopt, NoIntegrate,HandleSelf, ScrambleSelf, QQ,
DD, VV, HandleSwitch, PredPredWeight, PreyPreyWeight
adjust.scenario(Rsim.scenario, parameter, group, groupto = NA, value)adjust.scenario(Rsim.scenario, parameter, group, groupto = NA, value)
Rsim.scenario |
Scenario object that contains all of the rsim rates and
forcing functions generated by |
parameter |
Parameters to be modified (Choose from: |
group |
The model group that the parameter change will affect. Note that
a value of 'all' will affect all groups associated with the 'groupto'
variable. Valid values are found in the 'Group' field of the object created
from running |
groupto |
The corresponding group who's parameter is affecting the group
variable. Required for parameters |
value |
New value for the parameter. |
Returns an rsim.scenario() object with the new parameter.
Other Adjust functions:
adjust.fishing(),
adjust.forcing(),
set.rsim.scene()
# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Adjust the PBopt parameter for cod. Set to value = 2 Rsim.scenario.adjusted <- adjust.scenario(Rsim.scenario, parameter="PBopt",group = "cod", groupto = "all", value = 2)# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Adjust the PBopt parameter for cod. Set to value = 2 Rsim.scenario.adjusted <- adjust.scenario(Rsim.scenario, parameter="PBopt",group = "cod", groupto = "all", value = 2)
Logical check that the parameter files are filled out correctly, i.e. data is entered where it is expected.
check.rpath.params(Rpath.params)check.rpath.params(Rpath.params)
Rpath.params |
R object containing the parameters needed to create a
|
Checks Rpath parameter files for consistency. An error message will be produced if one of the logical checks fails. Checks include: verification that all types are represented (e.g. consumer, producer, detrital, and fleet); check if input parameters were entered correctly; check if Diet columns sum to 1. (NOTE: This does not ensure data is correct just that it is in the right places).
Other Rpath functions:
MTI(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.Rpath(),
write.rpath.params()
Parses an eiixml file exported using the Ecopath with Ecosim (EwE) GUI into an unbalanced Rpath model object, which can then be balanced. This function was tested on files exported by EwE version 6.7.
create.rpath.from.eiixml(eiifile, verbose = FALSE)create.rpath.from.eiixml(eiifile, verbose = FALSE)
eiifile |
Path to exported EwE XML file |
verbose |
Logical. Use for debugging. If TRUE, prints out a list of parsed tables and number of rows read from the XML file |
An Rpath object (list) with the following components:
stanzas |
Stanza parameters |
pedigree |
Pedigree parameters |
diet |
Diet parameters |
model |
Model parameters |
Other xml:
import.eiixml()
# Import an eiixml file previously exported from the EwE GUI, check that the # unbalanced model is functional, recalculate age-structured groups based on # imported stanza parameters (if the imported model has stanzas), and balance # the model. eiixml <- system.file("extdata/xml/Western_Bering_Sea.eiixml", package = "Rpath") rpath_object <- create.rpath.from.eiixml(eiixml) check.rpath.params(rpath_object) rpath_object <- rpath.stanzas(rpath_object) rpath_balanced <- rpath(rpath_object)# Import an eiixml file previously exported from the EwE GUI, check that the # unbalanced model is functional, recalculate age-structured groups based on # imported stanza parameters (if the imported model has stanzas), and balance # the model. eiixml <- system.file("extdata/xml/Western_Bering_Sea.eiixml", package = "Rpath") rpath_object <- create.rpath.from.eiixml(eiixml) check.rpath.params(rpath_object) rpath_object <- rpath.stanzas(rpath_object) rpath_balanced <- rpath(rpath_object)
Creates a shell of the Rpath.params list object which contains the model, diet,
multistanza, and pedigree parameters.
create.rpath.params(group, type, stgroup = NA)create.rpath.params(group, type, stgroup = NA)
group |
Vector of group names. |
type |
Numeric vector of group type. Living = 0, Producer = 1, Detritus = 2, Fleet = 3. |
stgroup |
Vector of multistanza group names. Include NA for non-stanza groups. |
Outputs a list object of Rpath.params which are populated with values
of NA or logical default values. Values can then be filled in using
R. Use check.rpath.params() to ensure parameter files are filled out
correctly (NOTE: This does not ensure data is correct just that it is
in the right places).
Other Rpath functions:
MTI(),
check.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.Rpath(),
write.rpath.params()
Rpath inputs for the eastern Bering Sea 1990s Ecopath model (53 biological groups and 1 fleet).
Ecosense.EBSEcosense.EBS
An unbalanced Rpath model object that contains:
A data.table containing Ecopath unbalanced ecosystem parameters (base parameters and fisheries).
A data.table containing the Ecopath model's diet matrix.
Parameters for multistanza groups.
A data.table containing the data quality (pedigree) for the Ecopath model.
...
This is an aggregated version of the 1990s eastern Bering Sea Ecopath model of Aydin et al. (2007) and does not include stanzas.
Whitehouse and Aydin 2020. Assessing the sensitivity of three Alaska marine food webs to perturbations: an example of Ecosim simulations using Rpath. https://doi.org/10.1016/j.ecolmodel.2020.109074
Aydin KY, Gaichas S, Ortiz I, Kinzey D, Friday N (2007) A comparison of the Bering Sea, Gulf of Alaska, and Aleutian Islands large marine ecosystems through food web modeling. U.S. Dep. Commer., NOAA Tech. Memo. NMFS-AFSC-178.
# Balance the model ebs_bal <- rpath(Ecosense.EBS)# Balance the model ebs_bal <- rpath(Ecosense.EBS)
Rpath inputs for the eastern Chukchi Sea Ecopath model (52 biological groups and 1 fleet).
Ecosense.ECSEcosense.ECS
An unbalanced Rpath model object that contains:
A data.table containing Ecopath unbalanced ecosystem parameters (base parameters and fisheries).
A data.table containing the Ecopath model's diet matrix.
Parameters for multistanza groups.
A data.table containing the data quality (pedigree) for the Ecopath model.
...
This is an aggregated version of the eastern Chukchi Sea Ecopath model of Whitehouse and Aydin (2016).
Whitehouse and Aydin 2020. Assessing the sensitivity of three Alaska marine food webs to perturbations: an example of Ecosim simulations using Rpath. https://doi.org/10.1016/j.ecolmodel.2020.109074
Whitehouse GA, Aydin KY (2016) Trophic structure of the eastern Chukchi Sea: An updated mass balance food web model. U.S. Dep Commer, NOAA Tech. Memo. NMFS-AFSC-318. doi:10.7289/V5/TM-AFSC-318
# Balance the model ecs_bal <- rpath(Ecosense.ECS)# Balance the model ecs_bal <- rpath(Ecosense.ECS)
Rpath inputs for the Gulf of Alaska (west/central) 1990s Ecopath model (49 biological groups and 1 fleet).
Ecosense.GOAEcosense.GOA
An unbalanced Rpath model object that contains:
A data.table containing Ecopath unbalanced ecosystem parameters (base parameters and fisheries).
A data.table containing the Ecopath model's diet matrix.
Parameters for multistanza groups.
A data.table containing the data quality (pedigree) for the Ecopath model.
...
This is an aggregated version of the 1990s Gulf of Alaska Ecopath model of Aydin et al. (2007) and does not include stanzas.
Whitehouse and Aydin 2020. Assessing the sensitivity of three Alaska marine food webs to perturbations: an example of Ecosim simulations using Rpath. https://doi.org/10.1016/j.ecolmodel.2020.109074
Aydin KY, Gaichas S, Ortiz I, Kinzey D, Friday N (2007) A comparison of the Bering Sea, Gulf of Alaska, and Aleutian Islands large marine ecosystems through food web modeling. U.S. Dep. Commer., NOAA Tech. Memo. NMFS-AFSC-178.
# Balance the model goa_bal <- rpath(Ecosense.GOA)# Balance the model goa_bal <- rpath(Ecosense.GOA)
Extracts group/node specific information from a scenario run using rsim.run()
extract.node(Rsim.output, group)extract.node(Rsim.output, group)
Rsim.output |
Object generated by |
group |
Name of the node/group for which you want to extract data. Valid values are found in the 'Group' field of the object
created from running |
Returns a list object with monthly node specific data
Biomass |
Vector of monthly Biomass values |
AnnualBiomass |
Vector of annual Biomass |
TotalCatch |
Vector of monthly Catch values |
AnnualTotalCatch |
Vector of annual Catch values |
Landings |
Dataframe (n x l) of monthly Landings. (Each column is a fishery that Lands the 'group') |
Discards |
Dataframe (n x d) of monthly Discards (Each column is a fishery that Discards the 'group') |
Other Rsim functions:
rsim.params(),
rsim.plot(),
rsim.run(),
rsim.scenario(),
rsim.step(),
write.Rsim()
# Read in Rpath parameter file and balance model Rpath <- rpath(Ecosense.EBS) # Create a 50 yr Rpath scenario Rsim.scenario <- rsim.scenario(Rpath, Ecosense.EBS, years = 1:50) # Run a scenario Rsim.output <- rsim.run(Rsim.scenario, method = "RK4", years = 1:50) # Extracts group (node) specific data from the simulation run group <- extract.node(Rsim.output,Rpath$Group['Squids'])# Read in Rpath parameter file and balance model Rpath <- rpath(Ecosense.EBS) # Create a 50 yr Rpath scenario Rsim.scenario <- rsim.scenario(Rpath, Ecosense.EBS, years = 1:50) # Run a scenario Rsim.output <- rsim.run(Rsim.scenario, method = "RK4", years = 1:50) # Extracts group (node) specific data from the simulation run group <- extract.node(Rsim.output,Rpath$Group['Squids'])
Creates a table of fishing mortalities by species group and gear for an
rsim.scenario() object.
frate.table(Rsim.scenario)frate.table(Rsim.scenario)
Rsim.scenario |
Scenario object that contains all of the rsim rates and
forcing functions generated by |
Returns a data table of F values for each species/gear combination.
Group |
Group/node |
Fishery/gearType |
Gear type for the fishery |
...
Total |
Sum over all gear types |
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.Rpath(),
write.rpath.params()
# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) rates <- frate.table(Rsim.scenario) # display the head of the data frame head(rates)# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) rates <- frate.table(Rsim.scenario) # display the head of the data frame head(rates)
Helper function that will retrieve the fishing forcing parameters that were used in an Rsim scenario
get.rsim.fishing(Rsim.scenario)get.rsim.fishing(Rsim.scenario)
Rsim.scenario |
Scenario object that contains all of the rsim rates and
forcing functions generated by |
Returns a 'fishing' object.
Other Get functions:
get.rsim.forcing(),
get.rsim.params(),
get.rsim.stanzas(),
get.rsim.start_state()
# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) params <- get.rsim.fishing(Rsim.scenario) names(params)# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) params <- get.rsim.fishing(Rsim.scenario) names(params)
Helper function that will retrieve the forcing parameters that were used in an Rsim scenario
get.rsim.forcing(Rsim.scenario)get.rsim.forcing(Rsim.scenario)
Rsim.scenario |
Scenario object that contains all of the rsim rates and
forcing functions generated by |
Returns a 'forcing' object.
Other Get functions:
get.rsim.fishing(),
get.rsim.params(),
get.rsim.stanzas(),
get.rsim.start_state()
# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) params <- get.rsim.forcing(Rsim.scenario) names(params)# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) params <- get.rsim.forcing(Rsim.scenario) names(params)
Helper function that will retrieve the parameters that were used in an Rsim scenario
get.rsim.params(Rsim.scenario)get.rsim.params(Rsim.scenario)
Rsim.scenario |
Scenario object that contains all of the rsim rates and
forcing functions generated by |
Returns a 'params' object.
Other Get functions:
get.rsim.fishing(),
get.rsim.forcing(),
get.rsim.stanzas(),
get.rsim.start_state()
# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) params <- get.rsim.params(Rsim.scenario) names(params)# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) params <- get.rsim.params(Rsim.scenario) names(params)
Helper function that will retrieve the stanza parameters that were used in an Rsim scenario
get.rsim.stanzas(Rsim.scenario)get.rsim.stanzas(Rsim.scenario)
Rsim.scenario |
Scenario object that contains all of the rsim rates and
forcing functions generated by |
Returns a 'stanzas' object.
Other Get functions:
get.rsim.fishing(),
get.rsim.forcing(),
get.rsim.params(),
get.rsim.start_state()
# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) params <- get.rsim.stanzas(Rsim.scenario) names(params)# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) params <- get.rsim.stanzas(Rsim.scenario) names(params)
Helper function that will retrieve the starting state values that were used in an Rsim scenario
get.rsim.start_state(Rsim.scenario)get.rsim.start_state(Rsim.scenario)
Rsim.scenario |
Scenario object that contains all of the rsim rates and
forcing functions generated by |
Returns an 'start_state' object.
Other Get functions:
get.rsim.fishing(),
get.rsim.forcing(),
get.rsim.params(),
get.rsim.stanzas()
# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) params <- get.rsim.start_state(Rsim.scenario) names(params)# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) params <- get.rsim.start_state(Rsim.scenario) names(params)
Plots the food web associated with an Rpath object using ggplot functions
ggwebplot( Rpath.obj, eco.name = attr(Rpath.obj, "eco.name"), line.col = "grey", highlight = NULL, highlight.col = c("black", "red", "orange"), labels = FALSE, label.num = FALSE, label.cex = 1, fleets = FALSE, type.col = "grey50", box.order = NULL, line.alpha = 0.5, point.size = 1, text.size = 5, max.overlaps = 10 )ggwebplot( Rpath.obj, eco.name = attr(Rpath.obj, "eco.name"), line.col = "grey", highlight = NULL, highlight.col = c("black", "red", "orange"), labels = FALSE, label.num = FALSE, label.cex = 1, fleets = FALSE, type.col = "grey50", box.order = NULL, line.alpha = 0.5, point.size = 1, text.size = 5, max.overlaps = 10 )
Rpath.obj |
Rpath model created by the |
eco.name |
Optional name of the ecosystem. Default is the 'eco.name' attribute from the rpath object. |
line.col |
The color of the lines between nodes of the food web. |
highlight |
Set to the group number or name to highlight the connections of that group.
Valid values are found in the 'Group' field of the object created from running |
highlight.col |
Color of the connections to the highlighted group, vector of length 3. Defaults to black = predator, red = prey, orange = fleet. |
labels |
Logical whether or not to display group names. |
label.num |
Logical whether or not to display group numbers instead of points at nodes.
If |
label.cex |
Numeric value of the relative size of the labels within the plot. |
fleets |
Logical value indicating whether or not to include fishing fleets in the food web. |
type.col |
The color of the points corresponding to the types of the group. Can either be of length 1 or 4. Color order will be living, primary producers, detrital, and fleet groups. |
box.order |
Vector of box numbers to change the default plot order. Must include all box numbers.
Passed to |
line.alpha |
Transparency of lines between nodes of the food web. |
point.size |
Size of points at nodes. |
text.size |
Size of text |
max.overlaps |
Maximum number of overlaps allowed for group labels by |
Returns a ggplot object visualizing the food web
# Read in Rpath parameter file, generate and name model object Rpath.obj <- rpath(AB.params, eco.name = "Anchovy Bay") # Plot food web diagram with all groups labeled, including fleets, using ggplot ggwebplot(Rpath.obj, labels = TRUE, fleets = TRUE) # Plot food web diagram without labels, highlighting connections of cod group ggwebplot(Rpath.obj, highlight = "cod",fleets = TRUE)# Read in Rpath parameter file, generate and name model object Rpath.obj <- rpath(AB.params, eco.name = "Anchovy Bay") # Plot food web diagram with all groups labeled, including fleets, using ggplot ggwebplot(Rpath.obj, labels = TRUE, fleets = TRUE) # Plot food web diagram without labels, highlighting connections of cod group ggwebplot(Rpath.obj, highlight = "cod",fleets = TRUE)
Parses an eiixml file exported using the Ecopath with Ecosim (EwE) GUI into a list of data frames,
one frame for each table in the exported XML file. This function is usually called by the function create.rpath.from.eiixml() that
converts these tables into an unbalanced rpath model object. However import.xml can be used on its own to examine the full set
of tables exported by EwE, including tables not currently imported into Rpath objects, such as Ecosim runs or model metadata.
This function was tested on files exported by EwE version 6.7.
import.eiixml(eiifile, verbose = FALSE)import.eiixml(eiifile, verbose = FALSE)
eiifile |
Path to exported EwE XML file |
verbose |
Logical. Use for debugging. If TRUE, prints out a list of parsed tables and number of rows read from the XML file |
A list of data frames, one data frame for each node (exported EwE table) in the XML file. Each table has the naming convention ewe_[table name] where [table name] is the name of the table provided by EwE.
Other xml:
create.rpath.from.eiixml()
# Import an eiixml file previously exported from the EwE GUI into a list of # data frames containing the model data eiixml <- system.file("extdata/xml","Western_Bering_Sea.eiixml", package = "Rpath") xml_data <- import.eiixml(eiixml)# Import an eiixml file previously exported from the EwE GUI into a list of # data frames containing the model data eiixml <- system.file("extdata/xml","Western_Bering_Sea.eiixml", package = "Rpath") xml_data <- import.eiixml(eiixml)
Uses a static Rpath model and creates a matrix of mixed trophic impacts.
MTI(Rpath, Rpath.params, increase = T)MTI(Rpath, Rpath.params, increase = T)
Rpath |
Rpath R object containing a static |
Rpath.params |
R object containing the |
increase |
Logical value indicating whether a marginal increase is applied. |
Returns a matrix of mixed trophic impacts.
Other Rpath functions:
check.rpath.params(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.Rpath(),
write.rpath.params()
Creates an Rpath.param object from a series of .csv files.
read.rpath.params( modfile, dietfile, pedfile = NA, stanzagroupfile = NA, stanzafile = NA )read.rpath.params( modfile, dietfile, pedfile = NA, stanzagroupfile = NA, stanzafile = NA )
modfile |
file location of the flat file containing the model parameters. |
dietfile |
file location of the flat file containing the diet parameters. |
pedfile |
file location of the flat file containing the pedgigree parameters. |
stanzagroupfile |
file location of the flat file containing the group parameters for multistanza groups. If not specified a blank stanza list will be created. |
stanzafile |
file location of the flat file containing the individual stanza parameters for multistanza groups. If not specified a blank stanza list will be created. |
Outputs an Rpath.param object that can be used for Rpath and subsequently
Rsim. (NOTE: This does function does not ensure data is correct or in the
correct locations.Run check.rpath.params() to ensure the appropriate columns are
present).
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
frate.table(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.Rpath(),
write.rpath.params()
Rpath inputs for a tutorial Rpath ecosystem.
REco.paramsREco.params
An unbalanced Rpath model object that contains:
A data.table containing Ecopath unbalanced ecosystem parameters (base parameters and fisheries).
A data.table containing the Ecopath model's diet matrix.
Parameters for multistanza groups.
A data.table containing the data quality (pedigree) for the Ecopath model.
...
Lucey SM, Gaichas SK, Aydin KY (2020) Conducting reproducible ecosystem modeling using the open source mass balance model Rpath. Ecol Model 427:11. doi:10.1016/j.ecolmodel.2020.109057
vignette("ModelSetup", package = "Rpath") for an example
of how to build this tutorial ecosystem.
# Balance the model REco_bal <- rpath(REco.params)# Balance the model REco_bal <- rpath(REco.params)
Performs initial mass balance using a Rpath.params() file
rpath(Rpath.params, eco.name = NA, eco.area = 1)rpath(Rpath.params, eco.name = NA, eco.area = 1)
Rpath.params |
R object containing the parameters needed to create a
|
eco.name |
Optional name of the ecosystem which becomes an attribute of the
|
eco.area |
Optional area of the ecosystem which becomes an attribute of the
|
Returns a static Rpath model that can be supplied to the
rsim.scenario function.
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.Rpath(),
write.rpath.params()
List of consumer groups from Rpath object with species type = 0.
rpath.consumers(Rpath)rpath.consumers(Rpath)
Rpath |
Balanced Rpath model generated by |
Returns a string vector containing the names of Rpath functional groups that are consumers
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.Rpath(),
write.rpath.params()
# Build the balanced Rpath model and parameter file by calling `rpath` Rpath <- rpath(Ecosense.EBS) # Run the consumers command consumerGroups = rpath.consumers(Rpath) # Print out the first few consumer group names head(consumerGroups)# Build the balanced Rpath model and parameter file by calling `rpath` Rpath <- rpath(Ecosense.EBS) # Run the consumers command consumerGroups = rpath.consumers(Rpath) # Print out the first few consumer group names head(consumerGroups)
List of detrital groups from Rpath object with species type = 2
rpath.detrital(Rpath)rpath.detrital(Rpath)
Rpath |
Balanced Rpath model generated by |
Returns a string vector containing the names of Rpath functional groups that are detrital.
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.Rpath(),
write.rpath.params()
# Build the balanced Rpath model and parameter file by calling `rpath` Rpath <- rpath(Ecosense.EBS) # Run the rpath.detrital command detritalGroups = rpath.detrital(Rpath) # Print out the first few detrital group names head(detritalGroups)# Build the balanced Rpath model and parameter file by calling `rpath` Rpath <- rpath(Ecosense.EBS) # Run the rpath.detrital command detritalGroups = rpath.detrital(Rpath) # Print out the first few detrital group names head(detritalGroups)
List of gears groups from Rpath object with species type = 3
rpath.gears(Rpath)rpath.gears(Rpath)
Rpath |
Balanced Rpath model generated by |
Returns a string vector containing the names of Rpath functional groups that are gear types
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.Rpath(),
write.rpath.params()
# Build the balanced Rpath model and parameter file by calling `rpath` Rpath <- rpath(Ecosense.EBS) # Run the groups command gearGroups = rpath.gears(Rpath) # Print out the first few gear type group names head(gearGroups)# Build the balanced Rpath model and parameter file by calling `rpath` Rpath <- rpath(Ecosense.EBS) # Run the groups command gearGroups = rpath.gears(Rpath) # Print out the first few gear type group names head(gearGroups)
Get a character vector of functional group names from an Rpath object (balanced model) or an Rpath.params object (unbalanced model parameters) based on the 'type' input parameter as follows: (0: consumers, 1: producers, 2: detrital, 3: gears, 0<type<1: mixotrophs). Living groups are consumers + producers. Note that mixotrophs are not returned as either consumers or producers, only separately.
rpath.groups(Rpath)rpath.groups(Rpath)
Rpath |
Balanced Rpath model generated by |
Returns a string vector containing the names of Rpath functional groups by category (group type).
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.Rpath(),
write.rpath.params()
# Build the balanced Rpath model and parameter file by calling `rpath` Rpath <- rpath(Ecosense.EBS) # Run the groups command groups = rpath.groups(Rpath) # Print out the first few group names head(groups)# Build the balanced Rpath model and parameter file by calling `rpath` Rpath <- rpath(Ecosense.EBS) # Run the groups command groups = rpath.groups(Rpath) # Print out the first few group names head(groups)
List of living groups from Rpath object. Living groups are those species groups with type < 2.
rpath.living(Rpath)rpath.living(Rpath)
Rpath |
Balanced Rpath model generated by |
Returns a string vector containing the names of Rpath functional groups that are living.
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.Rpath(),
write.rpath.params()
# Build the balanced Rpath model and parameter file by calling `rpath` Rpath <- rpath(Ecosense.EBS) # Run the rpath.living command livingGroups = rpath.living(Rpath) # Print out the first few living group names head(livingGroups)# Build the balanced Rpath model and parameter file by calling `rpath` Rpath <- rpath(Ecosense.EBS) # Run the rpath.living command livingGroups = rpath.living(Rpath) # Print out the first few living group names head(livingGroups)
List of groups from Rpath object with species type between 0 and 1
rpath.mixotrophs(Rpath)rpath.mixotrophs(Rpath)
Rpath |
Balanced Rpath model generated by |
Returns a string vector containing the names of Rpath functional groups that are mixotrophs
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.Rpath(),
write.rpath.params()
# Build the balanced Rpath model and parameter file by calling `rpath` Rpath <- rpath(Ecosense.EBS) # Run the groups command mixotrophGroups = rpath.mixotrophs(Rpath) # Print out the first few mixotroph group names head(mixotrophGroups)# Build the balanced Rpath model and parameter file by calling `rpath` Rpath <- rpath(Ecosense.EBS) # Run the groups command mixotrophGroups = rpath.mixotrophs(Rpath) # Print out the first few mixotroph group names head(mixotrophGroups)
List of producer groups from Rpath object with species type = 1
rpath.producers(Rpath)rpath.producers(Rpath)
Rpath |
Balanced Rpath model generated by |
Returns a string vector containing the names of Rpath functional groups that are producers
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.Rpath(),
write.rpath.params()
# Build the balanced Rpath model and parameter file by calling `rpath` Rpath <- rpath(Ecosense.EBS) # Run the groups command producerGroups = rpath.producers(Rpath) # Print out the first few producer group names head(producerGroups)# Build the balanced Rpath model and parameter file by calling `rpath` Rpath <- rpath(Ecosense.EBS) # Run the groups command producerGroups = rpath.producers(Rpath) # Print out the first few producer group names head(producerGroups)
Uses the leading stanza to calculate the biomass and consumption of other stanzas necessary to support the leading stanza.
rpath.stanzas(Rpath.params)rpath.stanzas(Rpath.params)
Rpath.params |
R object containing the parameters needed to create a
|
Calculates and adds biomass and consumption for trailing stanza groups. Also adds weight at age and number at age for multi-staza groups.
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
stanzaplot(),
webplot(),
write.Rpath(),
write.rpath.params()
Calculates the derivative for a single time step and saves the output
rsim.deriv(Rsim.scenario, sim.year = 0, sim.month = 0, tstep = 0)rsim.deriv(Rsim.scenario, sim.year = 0, sim.month = 0, tstep = 0)
Rsim.scenario |
Scenario object that contains all of the rsim rates and
forcing functions generated by |
sim.year |
Will inherit from apply functions |
sim.month |
Will inherit from apply functions |
tstep |
Sub-monthly time step usually set to 0. |
a data.frame object of model group (rows) values for 12 derivatives (columns):
Species, character names of model groups
DerivT, numeric net flow; Total Gain - Total Loss at the timestep
TotGain, numeric Total Gain, all flows into the group at the timestep
TotLoss, numeric Total Loss, all flows out of the group at the timestep
FoodGain, numeric flows into the group from consuming prey at the timestep
DetritalGain, numeric flows into the group from detritus at the timestep
FishingGain, numeric flows into the group from fishing at the timestep
UnAssimLoss, numeric flows out of the group due to unassimilated consumption at the timestep
ActiveRespLoss, numeric flows out of the group due to "heat loss" at the timtestep
FoodLoss, numeric flows out of the group from being consumed by predators at the timestep
MzeroLoss, numeric flows out of the group due to unaccounted mortality at the timestep
FishingLoss, numeric flows out of the group due to fishing at the timestep
DetritalLoss, numeric flows out of the group to detritus at the timestep
# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Calculate derivatives for year 2, month 6, first timestep Rsim.deriv <- rsim.deriv(Rsim.scenario, sim.year=2, sim.month = 6, tstep = 0)# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Calculate derivatives for year 2, month 6, first timestep Rsim.deriv <- rsim.deriv(Rsim.scenario, sim.year=2, sim.month = 6, tstep = 0)
Extracts a matrix of consumption (in model biomass units) of each prey over time
by a particular predator from the Rsim model output of rsim.run().
rsim.diet(Rsim.output, group)rsim.diet(Rsim.output, group)
Rsim.output |
R object containing the output from |
group |
Predator group from the |
a numeric matrix of annual (rows) consumption of each prey group (columns)
# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Run the Rsim simulation Rsim.output <- rsim.run(Rsim.scenario, method = "RK4", years = 1:50) # Extract a preadator's consumption of each prey over the model run Rsim.diet.whales <- rsim.diet(Rsim.output, group = "whales")# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Run the Rsim simulation Rsim.output <- rsim.run(Rsim.scenario, method = "RK4", years = 1:50) # Extract a preadator's consumption of each prey over the model run Rsim.diet.whales <- rsim.diet(Rsim.output, group = "whales")
Creates a matrix for forcing functions related to fishing: (ForcedEffort, ForcedFRate, and ForcedCatch). Default values are set to 1 for ForcedEffort, and to 0 ForcedFRate, and ForcedCatch for all timesteps and groups.
rsim.fishing(params, years)rsim.fishing(params, years)
params |
Rsim parameter object generated by |
years |
A vector of each year of the simulation. |
S3 object class Rsim.fishing, a list of 3 objects:
ForcedEffort, numeric matrix of monthly (rows) effort multiplier by fleet (columns)
ForcedFRate, numeric matrix of annual (rows) fishing mortality rate by biomass group (columns)
ForcedEffort, numeric matrix of annual (rows) total catch removal by biomass group (columns)
# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create dynamic parameters from Rpath model Rsim.params <- rsim.params(Rpath) # Create fishing matrix with default values Rsim.fishing <- rsim.fishing(Rsim.params, years = 1:50)# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create dynamic parameters from Rpath model Rsim.params <- rsim.params(Rpath) # Create fishing matrix with default values Rsim.fishing <- rsim.fishing(Rsim.params, years = 1:50)
Creates a matrix for forcing functions not related to fishing (ForcedPrey ForcedMort, ForcedRecs, ForcedSearch, ForcedActResp, ForcedMigrate, and ForcedBio). Default values are set to 1 for ForcedPrey ForcedMort, ForcedRecs, ForcedSearch and ForcedActResp, to 0 for ForcedMigrate and to -1 for ForcedBio for all timesteps and groups.
rsim.forcing(params, years)rsim.forcing(params, years)
params |
Rsim parameter object generated by |
years |
A vector of each year of the simulation. |
S3 object class Rsim.forcing, a list of 7 objects:
ForcedPrey, numeric matrix of monthly (rows) prey forcing by biomass group (columns)
ForcedMort, numeric matrix of monthly (rows) mortality multiplier by biomass group (columns)
ForcedRecs, numeric matrix of monthly (rows) recruitment multiplier by biomass group (columns)
ForcedSearch, numeric matrix of monthly (rows) search rate multiplier by biomass group (columns)
ForcedActresp, numeric matrix of monthly (rows) active respiration multiplier by biomass group (columns)
ForcedMigrate, numeric matrix of monthly (rows) migration forcing by biomass group (columns)
ForcedBio, numeric matrix of monthly (rows) biomass multiplier by biomass group (columns)
# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create dynamic parameters from Rpath model Rsim.params <- rsim.params(Rpath) # Create forcing matrix with default values Rsim.forcing <- rsim.forcing(Rsim.params, years = 1:50)# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create dynamic parameters from Rpath model Rsim.params <- rsim.params(Rpath) # Create forcing matrix with default values Rsim.forcing <- rsim.forcing(Rsim.params, years = 1:50)
Extracts a matrix of biomass removed (in model biomass units) for a particular
prey by each of its predators from the Rsim model output of rsim.run().
rsim.mort(Rsim.output, group)rsim.mort(Rsim.output, group)
Rsim.output |
R object containing the output from |
group |
Predator group from the |
a numeric matrix of annual (rows) biomass removed by each predator group (columns)
# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Run the Rsim simulation Rsim.output <- rsim.run(Rsim.scenario, method = "RK4", years = 1:50) # Extract a prey's biomass loss from each predator over the model run Rsim.mort.anchovy <- rsim.mort(Rsim.output, group = "anchovy")# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Run the Rsim simulation Rsim.output <- rsim.run(Rsim.scenario, method = "RK4", years = 1:50) # Extract a prey's biomass loss from each predator over the model run Rsim.mort.anchovy <- rsim.mort(Rsim.output, group = "anchovy")
Converts the outputs from Rpath into rates for use in Rsim.
rsim.params( Rpath, mscramble = 2, mhandle = 1000, preyswitch = 1, scrambleselfwt = 0, handleselfwt = 0, steps_yr = 12, steps_m = 1 )rsim.params( Rpath, mscramble = 2, mhandle = 1000, preyswitch = 1, scrambleselfwt = 0, handleselfwt = 0, steps_yr = 12, steps_m = 1 )
Rpath |
R object containing a static |
mscramble |
Base value for vulnerability in functional response; default = 2 (mixed response). |
mhandle |
Base value for handling time in functional response; default = 1000 (off). |
preyswitch |
Exponent for prey switching in functional response; default = 1 (off). |
scrambleselfwt |
Value of 1 indicates all predators overlap in the foraging arena while 0 treats predators individually. |
handleselfwt |
Value of 1 indicates all prey overlap in the arena and contribute to saturation while 0 treats prey individually. |
steps_yr |
Number of time steps per year; default = 12. |
steps_m |
Number of time steps per month; default = 1. |
Returns an object of class Rsim.params, a list of 39 objects that is passed to the rsim.run
function via the rsim.scenario function.
NUM_GROUPS, number of total model groups
NUM_LIVING, number of living model groups
NUM_DEAD, number of detritus model groups
NUM_GEARS, number of fishery model groups
NUM_BIO, number of living + detritus model groups
spname, named NUM_GROUPS+1 length character vector beginning with "Outside" containing names of all model groups
spnum, named NUM_GROUPS+1 length character vector beginning with "Outside" numbered 0, containing numbers of all model groups
B_BaseRef, named NUM_GROUPS+1 length character vector beginning with "Outside" containing Rpath base biomass of all model groups
MzeroMort, named NUM_GROUPS+1 length character vector beginning with "Outside" containing unaccounted mortality, calculated as PB * (1.0 - EE), of all model groups
UnassimRespFrac, named NUM_GROUPS+1 length character vector beginning with "Outside" containing the proportion of consumption that goes to detritus of all model groups
ActiveRespFrac, named NUM_GROUPS+1 length character vector beginning with "Outside" containing the proportion of consumption that is "lost to heat" for all model groups
FtimeAdj, named NUM_GROUPS+1 length character vector beginning with "Outside" containing rate of change of feeding time, currently set to 0 for all model groups
FtimeQBOpt, named NUM_GROUPS+1 length character vector beginning with "Outside" containing base QB for all consumer model groups, or base PB for primary producers
PBopt, named NUM_GROUPS+1 length character vector beginning with "Outside" containing base PB for all model groups
NoIntegrate, named NUM_GROUPS+1 length character vector beginning with "Outside" containing flag set to 0 for high turnover model groups and set to spnum for all others
Handleself, named NUM_GROUPS+1 length character vector beginning with "Outside" containing flag for handling time influence, set for all model groups with function argument handleselfwt, default 0 for individual prey handling time
Scrambleself, named NUM_GROUPS+1 length character vector beginning with "Outside" containing flag for predator density influence, set for all model groups with function argument scrambleselfwt, default 0 for individual predator density dependent predation
PreyFrom, numeric vector length NumPredPreyLinks+1, spnum of prey for each predator prey interaction pair in the model
PreyTo, numeric vector length NumPredPreyLinks+1, spnum of predator for each predator prey interaction pair in the model
QQ, numeric vector length NumPredPreyLinks+1, base consumption rate for each predator prey interaction pair in the model
DD, numeric vector length NumPredPreyLinks+1, handling time effect on functional response for each predator prey pair, set for all model groups with function argument mhandle, default = 1000
VV, numeric vector length NumPredPreyLinks+1, vulnerability effect on functional response for each predator prey pair, set for all model groups with function argument mscramble, default = 2
HandleSwitch, numeric vector length NumPredPreyLinks+1, prey density dependence effect on functional response for each predator prey pair, set for all model groups with function argument preyswitch, default = 1
PredPreyWeight, numeric vector length NumPredPreyLinks+1, relative weight of individual predator to total predators for each predator prey pair, used if scrambleselfwt>0
PreyPreyWeight, numeric vector length NumPredPreyLinks+1, relative weight of individual prey to total prey for each predator prey pair, used if handleselfwt>0
NumPredPreyLinks, number of predator to prey linkages over all groups in the model
FishFrom, numeric vector length NumFishingLinks+1, spnum of landing and discard for each fishery interaction in the model
FishThrough, numeric vector length NumFishingLinks+1, spnum of gear type for each fishery interaction in the model
FishQ, numeric vector length NumFishingLinks+1, landings or discards relative to base fished group biomass for each fishery interaction in the model
FishTo, numeric vector length NumFishingLinks+1, spnum of sink for each fishery interaction in the model ("Outside" for landings or detritus group for discards)
NumFishingLinks, number of model group landings and discards to fishery links over all groups in the model
DetFrac, numeric vector length NumDetLinks+1, fraction of detritus going to DetTo for each living and detritus group in the model
DetFrom, numeric vector length NumDetLinks+1, spnum flowing to detritus for each living and detritus group in the model
DetTo, numeric vector length NumDetLinks+1, spnum of detritus sink for each living and detritus group in the model
NumDetLinks, number of model group links to detritus over all groups in the model
BURN_YEARS, number of model run burn-in (spin up) years, default value -1
COUPLED, number to control species interactions, value of 0 allows density dependent non-interacting species, default value 1
RK4_STEPS, number of RK4 integration steps per month, default value 4
SENSE_LIMIT, numeric vector of multipliers on biomass determining acceptable range for continuing a model run within BURN_YEARS
Other Rsim functions:
extract.node(),
rsim.plot(),
rsim.run(),
rsim.scenario(),
rsim.step(),
write.Rsim()
# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create default dynamic parameters from Rpath model Rsim.params <- rsim.params(Rpath)# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create default dynamic parameters from Rpath model Rsim.params <- rsim.params(Rpath)
Plots the relative biomass of each group from an Rsim.output object.
rsim.plot(Rsim.output, spname = "all", indplot = F)rsim.plot(Rsim.output, spname = "all", indplot = F)
Rsim.output |
R object containing the output from |
spname |
Vector of species names to be displayed. The default "all" will display all group names |
indplot |
Logical value of whether to plot a single group or multiple groups |
Creates a figure of relative biomass
For a detailed example of how to use this plot command please see vignette("RunRsim")
Other Rsim functions:
extract.node(),
rsim.params(),
rsim.run(),
rsim.scenario(),
rsim.step(),
write.Rsim()
Carries out the numerical integration of the Rsim alogrithms.
rsim.run(Rsim.scenario, method = "RK4", years = 1:100)rsim.run(Rsim.scenario, method = "RK4", years = 1:100)
Rsim.scenario |
Scenario object that contains all of the rsim rates and
forcing functions generated by |
method |
Numerical integration method. Either 'AB' for Adams-Bashforth or 'RK4' for 4th order Runge-Kutta. |
years |
A vector of each year of the simulation. |
S3 object class Rsim.output, a list of 16 objects:
out_Biomass, numeric matrix of monthly (rows) output biomass values by biomass group (columns) for model run
out_Catch, numeric matrix of monthly (rows) output catch values by biomass group (columns) for model run
out_Gear_Catch, numeric matrix of monthly (rows) output catch by species/gear/disposition (columns) for model run
annual_Catch, numeric matrix of annual (rows) output catch values by biomass group (columns) for model run
annual_Biomass, numeric matrix of annual (rows) output biomass values by biomass group (columns) for model run
annual_QB, numeric matrix of annual (rows) output consumption:biomass values by biomass group (columns) for model run
annual_Qlink, numeric matrix of annual (rows) output consumption values by predator-prey pair (columns) for model run
end_state, list of 9 final value vectors for biomass groups, same components as those produced by rsim.state()
crash_year, integer flag; -1 no crash or year of model crash
pred, named character vector of predators in each predator prey pair
prey, named character vector of prey in each predator prey pair
Gear_Catch_sp, named character vector of species caught in gears for each disposition
Gear_Catch_gear, named character vector of gear types for each species and disposition
Gear_Catch_disp, character vector of catch disposition (Landing or Discard) for each species and gear
start_state, list of 9 initial value vectors for biomass groups, see output of rsim.state()
params, list of 4; 3 dimensioning parameters and 1 biomass group and fleet name vector
Other Rsim functions:
extract.node(),
rsim.params(),
rsim.plot(),
rsim.scenario(),
rsim.step(),
write.Rsim()
# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Run the Rsim simulation Rsim.output <- rsim.run(Rsim.scenario, method = "RK4", years = 1:50)# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Run the Rsim simulation Rsim.output <- rsim.run(Rsim.scenario, method = "RK4", years = 1:50)
Uses a static Rpath model and creates a scenario consisting of 5 list objects:
params generated by rsim.params(), start_state generated by rsim.state(),
forcing generated by rsim.forcing(), fishing generated by rsim.fishing(),
and 'stanzas generated by rsim.stanzas().
rsim.scenario(Rpath, Rpath.params, years = 1:100)rsim.scenario(Rpath, Rpath.params, years = 1:100)
Rpath |
R object containing a static |
Rpath.params |
R object containing the parameters needed to create a
|
years |
A vector of each year of the simulation. |
Returns an Rsim.scenario object that can be supplied to the
rsim.run() function. Rsim.scenario is a list of 5 objects:
params, list of 39 dynamic parameters and vectors derived from an Rpath model, see output of rsim.params()
start_state, list of 9 initial value vectors for biomass and size structured stanza groups, see output of rsim.state() and rsim.stanzas()
forcing, list of 7 matrices for time series forcing of biological attributes, see output of rsim.forcing()
fishing, list of 3 matrices for time series forcing of fishing attributes, see output of rsim.fishing()
stanzas, list of 21 parameters and vectors for age structured groups, see output of rsim.stanzas()
Other Rsim functions:
extract.node(),
rsim.params(),
rsim.plot(),
rsim.run(),
rsim.step(),
write.Rsim()
# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50)# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50)
rsim.sense() draws a random Rsim parameter set from distributions
centered on the supplied Rpath parameter estimates. The width of the
distribution for each parameter is defined by the data pedigree of the
Rpath.params object generated by either create.rpath.params() or
read.rpath.params(). The returned Rsim parameter set is functionally
equivalent to a params list object created by rsim.scenario().
rsim.sense(Rsim.scenario, Rpath.params, Vvary = c(0, 0), Dvary = c(0, 0))rsim.sense(Rsim.scenario, Rpath.params, Vvary = c(0, 0), Dvary = c(0, 0))
Rsim.scenario |
The |
Rpath.params |
Rpath parameter object (unbalanced model) containing the
data pedigree generated by either |
Vvary |
length-2 vector with (lower,upper) bounds of vulnerability parameters generated in log-space - 1, Vvary = log(X-1). Thus, the Walters et al. 1997 vulnerability range of (1,+inf) centered on 2 now becomes (-inf,+inf) centered on 0. |
Dvary |
length-2 vector with (lower,upper) bounds of handling time generation in log-space - 1. Scaled as Vvary, above (-inf,+inf), centered on 0. |
Returns a params list object that can be substituted for the
params list in an rsim.scenario object.
Walters C, Christensen V, Pauly D (1997) Structuring dynamic models of exploited ecosystems from trophic mass-balance assessments. Rev Fish Biol Fish 7:139-172. doi:10.1023/a:1018479526149
Whitehouse GA, Aydin KY (2020) Assessing the sensitivity of three Alaska marine food webs to perturbations: an example of Ecosim simulations using Rpath. Ecol Model 429:16. doi:10.1016/j.ecolmodel.2020.109074
vignette("ecosense", package = "Rpath") and Other Rpath
functions: read.rpath.params(),
create.rpath.params(), check.rpath.params(),
rpath(), rsim.scenario(),
rsim.run()
# Read in Rpath parameter file and balance model EBS_bal <- rpath(Ecosense.EBS) # Create a 100 yr Rsim scenario EBS_scene <- rsim.scenario(EBS_bal, Ecosense.EBS, years = 1:100) # Generate a new params list new_EBS_params <- rsim.sense(EBS_scene, Ecosense.EBS, Vvary = c(-4.5, 4.5), Dvary = c(-4.5, 4.5)) # assign the generated params to the Rsim.scenario object EBS_scene$params <- new_EBS_params# Read in Rpath parameter file and balance model EBS_bal <- rpath(Ecosense.EBS) # Create a 100 yr Rsim scenario EBS_scene <- rsim.scenario(EBS_bal, Ecosense.EBS, years = 1:100) # Generate a new params list new_EBS_params <- rsim.sense(EBS_scene, Ecosense.EBS, Vvary = c(-4.5, 4.5), Dvary = c(-4.5, 4.5)) # assign the generated params to the Rsim.scenario object EBS_scene$params <- new_EBS_params
Creates a list of stanza indices and parameters to be used by rsim.run.
rsim.stanzas(Rpath.params, state, params)rsim.stanzas(Rpath.params, state, params)
Rpath.params |
R object containing the parameters needed to create a
|
state |
List object of state variables generated by |
params |
Rsim parameter object generated by |
a list of 21 objects:
Nsplit, number of model groups with stanzas
Nstanzas, numeric vector length Nsplit+1, leading 0 for indexing followed by the number of age groups for each model group with stanzas
EcopathCode, numeric matrix of Rpath group numbers with Nsplit+1 species rows and Nstanzas+1 age group columns, first column and row empty for indexing
Age1, numeric matrix of age in months of first age group with Nsplit+1 species rows, first column and row empty for indexing, second column earliest age in months (0), third column max age in months
Age2, numeric matrix of age in months of last age group with Nsplit+1 species rows, first column and row empty for indexing, second column earliest age in months, third column max age in months
baseWageS, numeric matrix with rows of monthly weight relative to weight at infinity (Winf) calculated in rpath.stanzas with Nsplit+1 species columns
baseNageS, numeric matrix with rows of monthly numbers surviving, calculated in rpath.stanzas with Nsplit+1 species columns
baseQageS, numeric matrix with rows of monthly consumption, calculated as WageS^VBGFd in rpath.stanzas with Nsplit+1 species columns
Wmat, numeric vector length Nsplit+1, leading 0 for indexing followed by weight at 50% maturity relative to Winf for each model group with stanzas
RecPower, numeric vector length Nsplit+1, leading 0 for indexing followed by recruitment power parameter for each model group with stanzas
recruits, numeric vector length Nsplit+1, leading 0 for indexing followed by recruits per spawner entered as input to rpath.stanzas
VBGFd, numeric vector length Nsplit+1, leading 0 for indexing followed by von Bertalanffy d (default = 2/3) for each model group with stanzas
RzeroS, numeric vector length Nsplit+1, leading 0 for indexing followed by recruits per spawner entered as input to rpath.stanzas
vBM, numeric vector length Nsplit+1, leading 0 for indexing followed by von Bertalanffy growth coefficient for each model group with stanzas
SplitAlpha, numeric matrix of initial monthly (rows) growth coefficients for each model group with stanzas (Nsplit+1 species columns)
SpawnX, numeric vector length Nsplit+1, leading 0 for indexing followed by relative strength of spawner-recruit relationship for each model group with stanzas, currently set to 10000, no relationship
SpawnEnergy, numeric vector length Nsplit+1, leading 0 for indexing followed by relative energy going to recruitment rather than growth for each model group with stanzas, currently set to 1
baseEggsStanza, numeric vector length Nsplit+1, leading 0 for indexing followed by initial estimate of egg output for each model group with stanzas
baseSpawnBio, numeric vector length Nsplit+1, leading 0 for indexing followed by initial estimate of spawning biomass (=egg output) for each model group with stanzas
RscaleSplit, numeric vector length Nsplit+1, leading 0 for indexing followed by adult to juvenile metric scaling parameter for each model group with stanzas, currently set to 1
baseStanzaPred, numeric vector length NUM_GROUPS+1, base consumption (sum of QageS*NageS) for each model group with stanzas in full model group order; 0s entered for non-stanza groups
# Read in Rpath parameter file and generate model object Rpath <- rpath(REco.params) # Create default dynamic parameters from Rpath model Rsim.params <- rsim.params(Rpath) # Create state vectors with default values Rsim.state <- rsim.state(Rsim.params) # Create stanza object Rsim.stanzas <- rsim.stanzas(REco.params, Rsim.state, Rsim.params)# Read in Rpath parameter file and generate model object Rpath <- rpath(REco.params) # Create default dynamic parameters from Rpath model Rsim.params <- rsim.params(Rpath) # Create state vectors with default values Rsim.state <- rsim.state(Rsim.params) # Create stanza object Rsim.stanzas <- rsim.stanzas(REco.params, Rsim.state, Rsim.params)
Creates a matrix of starting state variables used by Rsim, including initial biomass and numbers by group, as well as feeding time (Ftime). Default initial values: N = 0, Ftime = 1
rsim.state(params)rsim.state(params)
params |
Rsim parameter object generated by |
S3 object class Rsim.state, a list of 3 objects:
Biomass, numeric vector of initial biomass by biomass group
N, numeric vector of initial numbers by biomass group
Ftime, numeric vector of initial feeding time parameter by biomass group
# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create dynamic parameters from Rpath model Rsim.params <- rsim.params(Rpath) # Create state vectors with default values Rsim.state <- rsim.state(Rsim.params)# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create dynamic parameters from Rpath model Rsim.params <- rsim.params(Rpath) # Create state vectors with default values Rsim.state <- rsim.state(Rsim.params)
Runs rsim.run and appends the output to a previous Rsim.output.
Currently only works with the Adams-Bashforth numerical integration method (AB).
rsim.step(Rsim.scenario, Rsim.output, method = "AB", year.end)rsim.step(Rsim.scenario, Rsim.output, method = "AB", year.end)
Rsim.scenario |
Scenario object that contains all of the rsim rates and
forcing functions generated by |
Rsim.output |
R object containing the output from |
method |
Numerical integration method. Either 'AB' for Adams-Bashforth or 'RK4' for 4th order Runge-Kutta. |
year.end |
The final year for the step interval |
Returns an Rsim.output object.
Other Rsim functions:
extract.node(),
rsim.params(),
rsim.plot(),
rsim.run(),
rsim.scenario(),
write.Rsim()
Modifies the various parameters of the rsim.scenario() object. Parameters
that can be adjusted using this function are: params,start_state,
forcing,fishing,stanzas
set.rsim.scene( Rsim.scenario, params = NULL, start_state = NULL, forcing = NULL, fishing = NULL, stanzas = NULL )set.rsim.scene( Rsim.scenario, params = NULL, start_state = NULL, forcing = NULL, fishing = NULL, stanzas = NULL )
Rsim.scenario |
Scenario object that contains all of the rsim rates and
forcing functions generated by |
params |
Rsim parameter object generated by |
start_state |
Rsim starting values object generated by |
forcing |
Rsim forcing matrix object generated by |
fishing |
Rsim fishing matrix object generated by |
stanzas |
Rsim stanza parameters object generated by |
Returns an Rsim.scenario object with the new parameter.
Other Adjust functions:
adjust.fishing(),
adjust.forcing(),
adjust.scenario()
# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) stanzas <- rsim.stanzas(AB.params) Rsim.scenario.new <- set.rsim.scene(Rsim.scenario,stanzas=stanzas)# Read in Rpath parameter file and generate balanced model Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) stanzas <- rsim.stanzas(AB.params) Rsim.scenario.new <- set.rsim.scene(Rsim.scenario,stanzas=stanzas)
Plots the biomass composition of multistanza groups from an Rpath.stanzas object.
stanzaplot( Rpath.params, StanzaGroup, line.cols = c("black", "green", "blue", "red") )stanzaplot( Rpath.params, StanzaGroup, line.cols = c("black", "green", "blue", "red") )
Rpath.params |
R object containing the parameters needed to create a
|
StanzaGroup |
The Stanza group's name to be plotted.Valid values are found in the 'stanzas' field of the Rpath parameter file. |
line.cols |
A vector of four colors used to represent the population biomass, relative number, individual weights, and stanza separation lines. |
Creates a figure showing the break down of biomass and number per stanza.
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
webplot(),
write.Rpath(),
write.rpath.params()
# Choose group with multiple stanzas params <- REco.params stanzaplot(params, StanzaGroup = "Roundfish1")# Choose group with multiple stanzas params <- REco.params stanzaplot(params, StanzaGroup = "Roundfish1")
Plots the food web associated with an Rpath object.
webplot( Rpath.obj, eco.name = attr(Rpath.obj, "eco.name"), line.col = "grey", highlight = NULL, highlight.col = c("black", "red", "orange"), labels = FALSE, label.pos = NULL, label.num = FALSE, label.cex = 1, fleets = FALSE, type.col = "black", box.order = NULL )webplot( Rpath.obj, eco.name = attr(Rpath.obj, "eco.name"), line.col = "grey", highlight = NULL, highlight.col = c("black", "red", "orange"), labels = FALSE, label.pos = NULL, label.num = FALSE, label.cex = 1, fleets = FALSE, type.col = "black", box.order = NULL )
Rpath.obj |
Rpath model created by |
eco.name |
Optional name of the ecosystem. Default is the 'eco.name' attribute from the
rpath object created from running |
line.col |
The color of the lines between nodes of the food web. |
highlight |
Group number or name to highlight the connections of that group. Valid values are found in the
'Group' field of the object created from running |
highlight.col |
Color of the connections to the highlighted group, vector of length 3. Defaults to black for prey, red for predator, orange for fleet. |
labels |
Logical whether or not to display group names. If |
label.pos |
A position specifier for the labels. Values of 1, 2, 3, 4
indicate positions below, to the left of, above, and to the right of the points, respectively. A null
value will cause the labels to be plotted without the points, assuming that |
label.num |
Logical value indication whether group numbers should be used for labels instead of names. |
label.cex |
Numeric value of the relative size of the labels within the plot. |
fleets |
Logical value indicating whether or not to include fishing fleets in the food web plot. |
type.col |
The color of the points corresponding to the types of the group. Must be of length 1 or 4. Color order will be consumers, primary producers, detrital, and fleet groups. |
box.order |
Vector of box numbers to change the default plot order. Must include all box numbers |
Returns a plot visualization of the food web.
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
write.Rpath(),
write.rpath.params()
# Read in Rpath parameter file, generate and name model object Rpath.obj <- rpath(AB.params, eco.name = "Anchovy Bay") # Plot food web diagram with all groups labeled, including fleets webplot(Rpath.obj, labels = TRUE, fleets = TRUE) # Plot food web diagram without labels, highlighting connections of cod group webplot(Rpath.obj, highlight = "cod",fleets = TRUE)# Read in Rpath parameter file, generate and name model object Rpath.obj <- rpath(AB.params, eco.name = "Anchovy Bay") # Plot food web diagram with all groups labeled, including fleets webplot(Rpath.obj, labels = TRUE, fleets = TRUE) # Plot food web diagram without labels, highlighting connections of cod group webplot(Rpath.obj, highlight = "cod",fleets = TRUE)
Outputs basic parameters or mortalities from a rpath() object to a .csv or .RData file.
write.Rpath(x, file = NA, morts = F)write.Rpath(x, file = NA, morts = F)
x |
Rpath model object generated by |
file |
file name for resultant file. Need to specify ".csv" or ".RData". |
morts |
Logical value whether to output basic parameters or mortalities. |
Writes a list object or file with the basic parameters or mortalities from an Rpath object.
If morts = F, output reflects the basic parameters of the mass-balanced model, namely:
Group |
Vector of group names |
type |
Vector of group types: 0 = consumer, 1 = producer, 2 = detritus, 3 = fishery |
TL |
Vector of trophic level for each group, calculated based on mass balance |
Biomass |
Vector of biomass values for each modeled group |
PB |
Vector of production:biomass ratios for each modeled group |
QB |
Vector of consumption:biomass ratios for each modeled group |
EE |
Vector of ecotrophic efficiency values for each modeled group |
GE |
Vector of gross efficiency values (production:comsumption ratios) for each modeled group |
Removals |
Vector of total fishery removals for each modeled group |
If morts = T, output reflects calculated mortality values for each group.
The number of columns will vary based on how many predators are in the model.
Group |
Vector of group names |
M0 |
Vector of natural mortality for each group. Natural mortality = PB * (1-EE) |
Fmort |
Vector of fishing mortality for each group |
M2.XX |
Vector of predation mortality, where XX is the name of a predator group |
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.rpath.params()
## Not run: # Read in Rpath parameter file, generate model object x <- rpath(AB.params) # Saves basic model parameters for all groups to the root directory of users project write.Rpath(x, file = "output.csv", morts = F) # Calculates natural mortality (M0), fishing mortality by fleet, and predation mortality by predator (M2) on each group # Writes output to an Rdata file in the root directory of users project write.Rpath(x, file = here::here("output.RData"), morts = T) ## End(Not run)## Not run: # Read in Rpath parameter file, generate model object x <- rpath(AB.params) # Saves basic model parameters for all groups to the root directory of users project write.Rpath(x, file = "output.csv", morts = F) # Calculates natural mortality (M0), fishing mortality by fleet, and predation mortality by predator (M2) on each group # Writes output to an Rdata file in the root directory of users project write.Rpath(x, file = here::here("output.RData"), morts = T) ## End(Not run)
Creates a series of .csv files from an Rpath.params object.
write.rpath.params(Rpath.params, eco.name, path = "")write.rpath.params(Rpath.params, eco.name, path = "")
Rpath.params |
R object containing the Rpath parameters. Most likely this
was created using |
eco.name |
ecosystem name that will be included in all the file names. |
path |
location for the output files. |
Outputs a series of .csv files named by the provided eco.name and the parameters they represent. For example the model parameters will be named "eco.name_model.csv".
Other Rpath functions:
MTI(),
check.rpath.params(),
create.rpath.params(),
frate.table(),
read.rpath.params(),
rpath(),
rpath.consumers(),
rpath.detrital(),
rpath.gears(),
rpath.groups(),
rpath.living(),
rpath.mixotrophs(),
rpath.producers(),
rpath.stanzas(),
stanzaplot(),
webplot(),
write.Rpath()
Outputs starting biomass, ending biomass, and catch to a .csv or .Rdata file.
write.Rsim(Rsim.output, file = NA)write.Rsim(Rsim.output, file = NA)
Rsim.output |
object created by the |
file |
file name for resultant file. Need to specify ".csv" or ".RData". |
Writes a list object or file with the start and end biomass and catch per group from an Rpath.sim object.
Group |
Vector of group names |
StartBio |
Vector of Biomass values at simulation start |
EndBio |
Vector of Biomass values at simulation end |
BioES |
Vector of ratio end:start Biomass values |
StartCatch |
Vector of Catch values at simulation start |
EndCatch |
Vector of Catch values at simulation end |
CatchES |
Vector of ratio end:start Catch values |
Other Rsim functions:
extract.node(),
rsim.params(),
rsim.plot(),
rsim.run(),
rsim.scenario(),
rsim.step()
# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Run the Rsim simulation Rsim.output <- rsim.run(Rsim.scenario, method = "RK4", years = 1:50) # Save summary output to a .csv file write.Rsim(Rsim.output, file = "output.csv")# Read in Rpath parameter file and generate model object Rpath <- rpath(AB.params) # Create a 50 yr Rsim scenario Rsim.scenario <- rsim.scenario(Rpath, AB.params, years = 1:50) # Run the Rsim simulation Rsim.output <- rsim.run(Rsim.scenario, method = "RK4", years = 1:50) # Save summary output to a .csv file write.Rsim(Rsim.output, file = "output.csv")