Package 'plant'

Title: A Package for Modelling Forest Trait Ecology and Evolution
Description: Solves trait, size and patch structured model from (Falster et al. 2016) using either method of characteristics or as stochastic, finite-sized population.
Authors: Daniel Falster [aut, cre] (ORCID: <https://orcid.org/0000-0002-9814-092X>), Richard FitzJohn [aut], Andrew O'Reilly-Nugent [aut], Mitchell Henry [ctb], Rafael Schouten [ctb], Isaac Towers [ctb], John Wilshire [ctb]
Maintainer: Daniel Falster <[email protected]>
License: GPL-2
Version: 2.0.0.9000
Built: 2026-06-04 10:52:16 UTC
Source: https://github.com/traitecoevo/plant

Help Index


Build Node Schedule

Description

Build an appropriately refined schedule for node introduction.

Usage

build_schedule(p, env = NULL, ctrl = scm_base_control())

Arguments

p

Parameters object

env

Environment object

ctrl

Control object

Details

There are control options (within the Parameters object) that affect how this function runs, in particular schedule_nsteps and schedule_eps control how refined the schedule will end up, and schedule_verbose controls if details are printed to the screen during construction.

Value

A Parameters object, with schedule components set. The output offspring produced is also available as an attribute birth_rate.

Author(s)

Rich FitzJohn


Control parameters

Description

Control parameters that tune various aspects of the numerical solvers.

Usage

Control(..., values = list(...))

Arguments

..., values

Values to initialise the struct with (either as variadic arguments, or as a list, but not both).


Disturbance regime

Description

Base class of representing patch disturbance

Usage

Disturbance_Regime()

Creates an environment object of specified type

Description

Creates an environment object of specified type

Usage

environment_type(type)

Environment(type = NULL)

Arguments

type

Any environment name as a string, e.g.: "FF16_Env".


Setup parameters to run resindets or mutants

Description

The functions expand_parameters and mutant_parameters convert trait values into parametr objects for the model. By default, expand_parameters adds an extra strategy to existing.

Usage

expand_parameters(
  trait_matrix,
  p,
  hyperpar = param_hyperpar(p),
  birth_rate_list = 1,
  keep_existing_strategies = TRUE
)

mutant_parameters(..., keep_existing_strategies = FALSE)

Arguments

trait_matrix

A matrix of traits corresponding to the new types to introduce.

p

A Parameters object.

hyperpar

Hyperparameter function to use. By default links to standard function for this strategy type.

birth_rate_list

List object with birth rates for each species in

keep_existing_strategies

Should existing residents be retained x. Birth rates can take the form of a scalar (constant) or a vector. In either case birth rates are set as strategy$birth_rate_y, however varying birth rates will also have strategy$birth_rate_x and

...

Arguments to expand_parameters

Author(s)

Rich FitzJohn


Fast Control Defaults

Description

Sets reasonable defaults for fast numerical calculations

Usage

fast_control(base = Control())

Arguments

base

An optional Control object. If omitted, the defaults are used.

Value

A Control object with parameters set.

Author(s)

Rich FitzJohn


Create an FF16_Environment object.

Description

Create an FF16_Environment object.

Usage

FF16_Environment()

K93_Environment()

Add additional state variables to the species component in output of a model.

Description

Add additional state variables to the species component in output of a model.

Usage

FF16_expand_state(results)

K93_expand_state(results)

expand_state(results)

TF24_expand_state(results)

Arguments

results

from 'tidy_patch'

Value

similar format to input, but with additional columns for additional state variables


Generates a report on stand grown with FF16 strategy

Description

Builds a detailed report on stand grown with FF16 strategy, based on the template Rmd file provided. The reports are rendered as html files and saved in the specified output folder.

Usage

FF16_generate_stand_report(
  results,
  output_file = "FF16_report.html",
  overwrite = FALSE,
  target_ages = NA,
  input_file = system.file("reports", "FF16_report.Rmd", package = "plant"),
  quiet = TRUE
)

Arguments

results

results of runnning run_scm_collect

output_file

name of output file

overwrite

logical value to determine whether to overwrite existing report

target_ages

Patches ages at which to make plots

input_file

report script (.Rmd) file to build study report

quiet

An option to suppress printing during rendering from knitr, pandoc command line and others.

Value

html file of the rendered report located in the specified output folder.


Hyperparameter function for FF16 physiological model

Description

Hyperparameter function for FF16 physiological model

Usage

FF16_hyperpar(m, s, filter = TRUE)

Arguments

m

A matrix of trait values, as returned by trait_matrix

s

A strategy object

filter

A flag indicating whether to filter columns. If TRUE, any numbers that are within eps of the default strategy are not replaced.


Create a FF16 Individual

Description

Create a FF16 Individual

Usage

FF16_Individual(s = FF16_Strategy())

Arguments

s

A FF16_Strategy object

Examples

pl <- FF16_Individual()
pl$height

Setup an a model system with default or specified parameters

Description

Setup an a model system with default or specified parameters. This function enables you initialize a model system. Use the model name to start different models.

Usage

FF16_Parameters(...)

K93_Parameters()

Arguments

...

Arguments to be passed to the model constructor. These include

*'patch_area': Area of idnividfual patch. Only relevant for stochastic model. Default is 1.0m2. *'max_patch_lifetime': The maximum time in years we want to simulate *'strategies': A list of stratgies to simulate. The default is an empty list. *'strategy_default': Values for the default startegy. The default values are those specified in the C++ code for the model. *'node_schedule_times_default': Default vector of times at which to introduce nodes. The default is chosen to have close spacing at the start of the simulation. *'node_schedule_times': A list with each element containing the vector of times we want to introduce nodes for each strategy. The default is an empty list. *'ode_times': A vector of patch ages we want the ode solver to stop at

Examples

p1 <- FF16_Parameters()
p2 <- FF16_Parameters(max_patch_lifetime = 10.0, patch_area = 1.0, strategies = list(FF16_Strategy()), strategy_default = FF16_Strategy(), node_schedule_times_default = node_schedule_times_default(10.0), node_schedule_times = list(node_schedule_times_default(10.0)), ode_times = c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10))

Strategy parameters

Description

Strategy parameters that tune various aspects of the biological model.

Usage

FF16_Strategy(..., values = list(...))

Arguments

..., values

Values to initialise the struct with (either as variadic arguments, or as a list, but not both).


Grow individual to given size

Description

Grow an individual up to particular sizes.

Usage

grow_individual_to_size(
  individual,
  sizes,
  size_name,
  env,
  time_max = Inf,
  warn = TRUE,
  filter = FALSE
)

grow_individual_to_height(individual, heights, env, ...)

Arguments

individual

An Individual object.

sizes

A vector of sizes to grow the plant to (increasing in size).

size_name

The name of the size variable within individual$rates (e.g., height).

env

An Environment object.

time_max

Time to run the ODE out for – only exists to prevent an infinite loop (say, on an unreachable size).

warn

Warn if requesting a plant that is too large?

filter

Filter individuals that are too large?

heights

Heights (when using grow_individual_to_height)

...

Additional parameters passed to grow_individual_to_size.

Value

A list with elements time (the time that a given size was reached), state (the ode state at these times, as a matrix) and plant a list of individuals grown to the appropriate size. Note that if only a single size is given, a list of length 1 is returned.


Grow a plant

Description

Grow a plant up for particular time lengths

Usage

grow_individual_to_time(individual, times, env)

Arguments

individual

An Individual object

times

A vector of times

env

An Environment object


Individual object

Description

Individual object

Usage

Individual(T, E)

Arguments

T

String containing class of plant strategy to create;

E

String containing class of environmnet to create;


Integrate over the size distribution for each species at each time point, to give totals of each variable Integrations are performed using trapezium integration

Description

Integrate over the size distribution for each species at each time point, to give totals of each variable Integrations are performed using trapezium integration

Usage

integrate_over_size_distribution(tidy_species_data)

Arguments

tidy_species_data

output of either 'tidy_patch' or 'tidy_species'

Value

a tibble whose columns provide metrics on integrated totals for each variable for each species at each time


Extract Internals from plant object

Description

Internals class holding vectors of states, thier associated rates and auxiliary (aux) state which is calculated from the state through running compute_rates

Usage

Internals(s_size, a_size)

Arguments

s_size

???

a_size

???


Interpolate data on size distributions for each species to specific heights at every time point

Description

Interpolate data on size distributions for each species to specific heights at every time point

Usage

interpolate_to_heights(
  tidy_species_data,
  heights,
  method = "natural",
  min_log_density = -100
)

Arguments

tidy_species_data

output of either 'tidy_patch' or 'tidy_species'

heights

heights to interpolate to

method

Method for interpolation. For more info see help on stats::spline

min_log_density

Set minimum possible value of log_density

Value

Returns a tibble of similar format to input, but with all outputs interpolated to specified hieghts.


Interpolate data on size distributions for each species to specific timer points, using specified interpolation method

Description

Interpolate data on size distributions for each species to specific timer points, using specified interpolation method

Usage

interpolate_to_times(tidy_species_data, times, method = "natural")

Arguments

tidy_species_data

output of either 'tidy_patch' or 'tidy_species'

times

times to interpolate to

method

Method for interpolation. For more info see help on stats::spline

Value

Returns a tibble of similar format to input, but with all outputs interpolated to specified hieghts.


Spline interpolation

Description

Spline interpolation

Usage

Interpolator()

Hyperparameter function for K93 physiological model

Description

Hyperparameter function for K93 physiological model

Usage

K93_hyperpar(m, s, filter = TRUE)

Arguments

m

A matrix of trait values, as returned by trait_matrix

s

A strategy object

filter

A flag indicating whether to filter columns. If TRUE, any numbers that are within eps of the default strategy are not replaced.


Create a K93 Individual or Node

Description

Create a K93 Individual or Node

Usage

K93_Individual(s = K93_Strategy())

Arguments

s

A K93_Strategy object

Examples

pl <- K93_Individual()
pl$height

Strategy parameters

Description

Strategy parameters that tune various aspects of the biological model.

Usage

K93_Strategy(..., values = list(...))

Arguments

..., values

Values to initialise the struct with (either as variadic arguments, or as a list, but not both).


Leaf model

Description

Leaf model

Usage

Leaf(
  vcmax_25,
  c,
  b,
  psi_crit,
  beta2,
  jmax_25,
  hk_s,
  a,
  curv_fact_elec_trans,
  curv_fact_colim,
  GSS_tol_abs,
  vulnerability_curve_ncontrol,
  ci_abs_tol,
  ci_niter,
  g0,
  g1
)

Arguments

vcmax_25

Maximum Carboxylation Rate (umol m^-2 s^-1)

c

shape parameter of hydraulic vulnerability curve (unitless)

b

sensitivity parameter of hydraulic vulnerability curve (MPa)

psi_crit

critical psi stem (-MPa )

beta2

exponent for effect of hydraulic risk (unitless)

jmax_25

maximum rate of electron transport (umol m^-2 s^-1)

hk_s

maximum hydraulic-dependent sapwood turnover rate yr ^ -1

a

quantum yield of photosynthetic electron transport (mol mol^-1)

curv_fact_elec_trans

curvature factor for the light response curve (unitless)

curv_fact_colim

curvature factor for the colimited photosythnthesis equatiom

GSS_tol_abs

tolereance parameter for golden section search

vulnerability_curve_ncontrol

number of points for pre-calculating vulnerability curve

ci_abs_tol

absolute tolerance value for root-solving ci

ci_niter

maximum number of iterations for root-solving ci

g0

g0 parameter in the medlyn model umol m^-2 s^-1

g1

parameter in the medlyn model umol kPa^0.5


Hyperparameters for FF16 physiological model

Description

Hyperparameters for FF16 physiological model

Hyperparameters for TF24 physiological model

Usage

make_FF16_hyperpar(
  lma_0 = 0.1978791,
  B_kl1 = 0.4565855,
  B_kl2 = 1.71,
  rho_0 = 608,
  B_dI1 = 0.01,
  B_dI2 = 0,
  B_ks1 = 0.2,
  B_ks2 = 0,
  B_rs1 = 4012,
  B_rb1 = 2 * 4012,
  B_f1 = 3,
  narea = 0.00187,
  narea_0 = 0.00187,
  B_lf1 = 5120.738 * 0.00187 * 24 * 3600/1e+06,
  B_lf2 = 0.5,
  B_lf3 = 0.04,
  B_lf4 = 21000,
  B_lf5 = 1,
  k_I = 0.5,
  latitude = 0
)

make_TF24_hyperpar(
  lma_0 = 0.1978791,
  B_kl1 = 0.4565855,
  B_kl2 = 1.71,
  rho_0 = 608,
  B_dI1 = 0.01,
  B_dI2 = 0,
  B_ks1 = 0.2,
  B_ks2 = 0,
  B_rs1 = 4012,
  B_rb1 = 2 * 4012,
  B_f1 = 3,
  narea = 0.00187,
  narea_0 = 0.00187,
  B_lf1 = 5120.738 * 0.00187 * 24 * 3600/1e+06,
  B_lf2 = 0.5,
  B_lf3 = 0.04,
  B_lf4 = 21000,
  B_lf5 = 1,
  k_I = 0.5,
  latitude = 0
)

Arguments

lma_0

Central (mean) value for leaf mass per area [kg /m2]

B_kl1

Rate of leaf turnover at lma_0 [/yr]

B_kl2

Scaling slope for phi in leaf turnover [dimensionless]

rho_0

Central (mean) value for wood density [kg /m3]

B_dI1

Rate of instantaneous mortality at rho_0 [/yr]

B_dI2

Scaling slope for wood density in intrinsic mortality [dimensionless]

B_ks1

Rate of sapwood turnover at rho_0 [/yr]

B_ks2

Scaling slope for rho in sapwood turnover [dimensionless]

B_rs1

CO_2 respiration per unit sapwood volume [mol / yr / m3 ]

B_rb1

CO_2 respiration per unit sapwood volume [mol / yr / m3 ]

B_f1

Cost of seed accessories per unit seed mass [dimensionless]

narea

nitrogen per leaf area [kg / m2]

narea_0

central (mean) value for nitrogen per leaf area [kg / m2]

B_lf1

Potential CO_2 photosynthesis at average leaf nitrogen [mol / d / m2]

B_lf2

Curvature of leaf photosynthetic light response curve [dimensionless]

B_lf3

Quantum yield of leaf photosynthetic light response curve [dimensionless]

B_lf4

CO_2 respiration per unit leaf nitrogen [mol / yr / kg]

B_lf5

Scaling exponent for leaf nitrogen in maximum leaf photosynthesis [dimensionless]

k_I

light extinction coefficient [dimensionless]

latitude

degrees from equator (0-90), used in solar model [deg]


Hyperparameters for physiological model

Description

Set a suitable hyperparameter function for chosen physiological model

Usage

make_hyperpar(type)

param_hyperpar(parameters)

hyperpar(type)

Arguments

type

Any strategy name as a string, e.g.: "FF16".

parameters

A parameters object


Hyperparameters for K93 physiological model

Description

Construct hyperparameter object for K93 physiological model

Usage

make_K93_hyperpar(
  b_0 = 0.059,
  b_1 = 0.012,
  b_2 = 0.00041,
  c_0 = 0.008,
  c_1 = 0.00044,
  d_0 = 0.00073,
  d_1 = 0.044,
  eta = 12,
  k_I = 0.01
)

Arguments

b_0

Growth intercept year-1

b_1

Growth asymptote year-1.(ln cm)-1

b_2

Growth suppression rate m2.cm-2.year-1

c_0

Mortality intercept year-1

c_1

Mortality suppression rate m2.cm-2.year-1

d_0

Recruitment rate (cm2.year-1)

d_1

Recruitment suppression rate (m2.cm-2)

eta

Crown shape parameter

k_I

Extinction coefficient used when estimating competitive effect


No disturbance regime No_Disturbance_Regime control object

Description

A disturbance-free regime for running individual patches

Usage

No_Disturbance()

Generate Default Node Introduction Times

Description

Generate a suitable set of default node introduction times, biased so that introductions are more closely packed at the beginning of time, become increasingly spread out.

Usage

node_schedule_times_default(max_time)

Arguments

max_time

Time to generate introduction times up to (the last introduction time will be at least max_time).

Details

The reason for the stepped distribution is to keep step sizes as series of doublings. Doing this limits the range of possible introduction times from an infinite set of possible values to a very limited subset of values (based on combinations of 1, 0.5, 0.25, 0.125 etc). The reason for doing this is to minimise the number of unique introduction times across all species. The ODE stepper needs to stop at each point where a node is introduced. If each species was selecting a bunch of points that was essentially unique (compared to those selected for all other species), the number of unique node introductions times could get very large, requiring more ODE steps.

Value

Vector of introduction times.

Author(s)

Rich FitzJohn, adapted from original C++ code by Daniel S. Falster.


Schedule of node introduction times

Description

Schedule of node introduction times

Usage

NodeSchedule(n_species)

Arguments

n_species

number of species


ODE Control parameters

Description

Control parameters for the ode system

Usage

OdeControl(..., values = list(...))

Arguments

..., values

Values to initialise the struct with (either as variadic arguments, or as a list, but not both).


The function 'optimise_individual_rate_at_height_by_trait' and 'optimise_individual_rate_at_size_by_trait' solve for the maximum of some rate (e.g. growth rate) at a specified height within the interval of the bounds of a given trait

Description

The function 'optimise_individual_rate_at_height_by_trait' and 'optimise_individual_rate_at_size_by_trait' solve for the maximum of some rate (e.g. growth rate) at a specified height within the interval of the bounds of a given trait

Usage

optimise_individual_rate_at_size_by_trait(
  type = "FF16",
  bounds,
  log_scale = TRUE,
  tol = 0.001,
  size = 1,
  size_name = "height",
  rate = size_name,
  params = scm_base_parameters(type),
  env = Environment(type),
  hyperpars = hyperpar(type),
  set_state_directly = FALSE
)

optimise_individual_rate_at_height_by_trait(..., height = 1)

Arguments

type

The type of model to use (e.g. "FF16"). Defaults to "FF16"

bounds

A vector giving the lower and upper bounds of the trait

log_scale

Should the trait be optimised on a log scale? Defaults to TRUE

tol

The tolerance for the optimisation

size

The size of the individual to optimise the rate at

size_name

The name of the size variable specified by size

rate

The name of the rate to optimise. Defaults to size_name

params

The parameters of the model

env

The environment of the model

hyperpars

The hyperparameter function of the model

set_state_directly

If TRUE, set the state directly to the size, otherwise grows the plant to that size. Defaults to FALSE

...

Additional parameters passed to optimise_individual_rate_at_size_by_trait

height

Heigh at which grow is optimsied. Defaults to 1

Author(s)

Isaac Towers, Daniel Falster and Andrew O'Reilly-Nugent


Activate logging with loggr

Description

Activate logging with loggr

Usage

plant_log_console(
  file_name = "console",
  .message = FALSE,
  .warning = FALSE,
  .error = FALSE,
  ...
)

Arguments

file_name

File to save output (default = console)

.message, .warning, .error

Include messages, warnings or errors? By default (and in contrast to loggr::log_file these are disabled here.

...

Additional parameters passed to loggr::log_file, but not file_name which is hard coded here to "console".

Details

By default plant prints little information about its progress. This can be modified by enabling logging. A formatter that is different to the default loggr::log_file formatter is selected here; it will print additional information that plant's internal logging functions record.

"Schedule" events (splitting) are sent to the DEBUG stream, everything else is sent to INFO. All events have a "routine" field added to them, which is useful if sent to a Redis server (using loggr.redis).


Title

Description

Title

Usage

plot_size_distribution(data_species)

Arguments

data_species

??


Gauss-Kronrod Quadrature

Description

Gauss-Kronrod Quadrature

Usage

QK(rule)

Arguments

rule

Degree of the rule; valid sizes are 15, 21, 31, 41, 51, 61.


Whole plant light compensation point

Description

Compute the whole plant light compensation point for a single plant.

Usage

resource_compensation_point(p, ...)

Arguments

p

A PlantPlus, with strategy, height, etc set.

...

Additional arguments that are ignored

Author(s)

Rich FitzJohn


Check performance on current system using package bench

Description

Check performance on current system using package bench

Usage

run_plant_benchmarks(
  strategy_types = list(FF16 = FF16_Strategy, TF24 = TF24_Strategy, K93 = K93_Strategy),
  iterations = 1
)

Arguments

strategy_types

A list of name strategy types to be tests

iterations

The number of iterations to be run

Value

A dataframe of results


Run SCM

Description

Run the SCM, returning the SCM object for interrogation

Usage

run_scm(
  p,
  env = NULL,
  ctrl = scm_base_control(),
  use_ode_times = FALSE,
  collect = FALSE
)

run_scm_collect(p, env = NULL, ctrl = scm_base_control())

Arguments

p

Parameters object

env

Environment object (defaults to FF16_Environment)

ctrl

Control object

use_ode_times

Should ODE times be used?

collect

Should results be collected?

Value

A SCM object.

Author(s)

Rich FitzJohn


Run a stochastic patch, Collecting Output

Description

Run a stochastic simulation of a patch, given a Parameters

Usage

run_stochastic_collect(
  p,
  env = NULL,
  ctrl = scm_base_control(),
  random_schedule = TRUE
)

Arguments

p

A FF16_Parameters object

env

Environment object

ctrl

Control object

random_schedule

setting to TRUE causes algorithm to generate a random schedule based on offspring arrival and area.

Details

This one might need to be made differently so that different schedules can be added easily. Not sure if this is how we will generally want to do this. Consider this function liable to change.

Author(s)

Rich FitzJohn


Sensible, fast (ish) SCM control settings

Description

Hopefully sensible set of parameters for use with the SCM. Turns accuracy down a bunch, makes it noisy, sets up the hyperparameterisation that we most often use.

Usage

scm_base_control()

Author(s)

Rich FitzJohn


Basic default parameters for a given strategy

Description

Basic default settings for a given strategy, environment only really used for templating initially and will be overloaded later by passing an environment to the SCM API (suggesting perhaps the template could be removed).

Usage

scm_base_parameters(type = NA, env = environment_type(type))

Arguments

type

Any strategy name as a string, e.g.: "FF16".

env

And environment object

Author(s)

Rich FitzJohn


Sequence in log space

Description

Sequence in log space

Usage

seq_log(from, to, length.out)

seq_log_range(r, length.out)

seq_range(r, length.out)

Arguments

from

Starting point

to

Ending point

length.out

Number of points to generate

r

range (i.e., c(from, to)

Details

Unlike the billions of options for seq, only length.out is supported here, and both from and to must be provided. For completeness, seq_range generates a range in non-log space.

Author(s)

Rich FitzJohn


Create a list of Strategies

Description

Create a list of Strategies or Plants by varying a single trait.

Usage

strategy_list(
  x,
  parameters,
  hyperpar = param_hyperpar(parameters),
  birth_rate_list
)

Arguments

x

Values for the trait. This must be a matrix, with column names corresponding to entries in Strategy and rows representing different values.

parameters

Parameters object containing a default strategy to modify. Any hyperparameterisation included will be applied.

hyperpar

Hyperparameter function to use. By default links to standard function for this strategy type.

birth_rate_list

List object with birth rates for each species in x. Birth rates can take the form of a scalar (constant) or a vector. In either case birth rates are set as strategy$birth_rate_y, however varying birth rates will also have strategy$birth_rate_x and


Create an TF24_Environment object.

Description

This environment is used for the TF24 strategy, which includes soil moisture and hydraulic conductivity parameters.

Usage

TF24_Environment()

Generates a report on stand grown with TF24 strategy

Description

Builds a detailed report on stand grown with TF24 strategy, based on the template Rmd file provided. The reports are rendered as html files and saved in the specified output folder.

Usage

TF24_generate_stand_report(
  results,
  output_file = "TF24_report.html",
  overwrite = FALSE,
  target_ages = NA,
  input_file = system.file("reports", "TF24_report.Rmd", package = "plant"),
  quiet = TRUE
)

Arguments

results

results of runnning run_scm_collect

output_file

name of output file

overwrite

logical value to determine whether to overwrite existing report

target_ages

Patches ages at which to make plots

input_file

report script (.Rmd) file to build study report

quiet

An option to suppress printing during rendering from knitr, pandoc command line and others.

Value

html file of the rendered report located in the specified output folder.


Hyperparameter function for TF24 physiological model

Description

Hyperparameter function for TF24 physiological model

Usage

TF24_hyperpar(m, s, filter = TRUE)

Arguments

m

A matrix of trait values, as returned by trait_matrix

s

A strategy object

filter

A flag indicating whether to filter columns. If TRUE, any numbers that are within eps of the default strategy are not replaced.


Create a TF24 Plant or Node

Description

Create a TF24 Plant or Node

Usage

TF24_Individual(s = TF24_Strategy())

Arguments

s

A TF24_Strategy object

Examples

pl <- TF24_Individual()
pl$height

Setup an a TF24 system with default or specified parameters

Description

Setup an a model system with default or specified parameters.

Usage

TF24_Parameters(...)

Arguments

...

Arguments to be passed to the model constructor. These include

*'patch_area': Area of idnividfual patch. Only relevant for stochastic model. Default is 1.0m2. *'max_patch_lifetime': The maximum time in years we want to simulate *'strategies': A list of stratgies to simulate. The default is an empty list. *'strategy_default': Values for the default startegy. The default values are those specified in the C++ code for the model. *'node_schedule_times_default': Default vector of times at which to introduce nodes. The default is chosen to have close spacing at the start of the simulation. *'node_schedule_times': A list with each element containing the vector of times we want to introduce nodes for each strategy. The default is an empty list. *'ode_times': A vector of patch ages we want the ode solver to stop at

Examples

p1 <- TF24_Parameters()
p2 <- TF24_Parameters(max_patch_lifetime = 10.0)

Strategy parameters

Description

Strategy parameters that tune various aspects of the biological model.

Usage

TF24_Strategy(..., values = list(...))

Arguments

..., values

Values to initialise the struct with (either as variadic arguments, or as a list, but not both).


Turn 'results' of plant solver, when solving individuals into a tidy data object

Description

Turn 'results' of plant solver, when solving individuals into a tidy data object

Usage

tidy_individual(results)

Arguments

results

plant solver output.

Value

a tibble whose columns provide metrics on each individual over time


Turn 'species' component of plant solver output into a tidy data object

Description

Turn 'species' component of plant solver output into a tidy data object

Turn 'env' component of solver output into a tidy data object

Turns output of plant solver into a tidy data object

Usage

tidy_species(results)

tidy_env(results)

tidy_patch(results)

Arguments

results

output of run_scm_collect

Value

a list, containing outputs of plant solver in tidy format


Create trait matrix

Description

Helper function to create trait matrices suitable for strategy_list.

Usage

trait_matrix(x, trait_name)

Arguments

x

Values

trait_name

Name of a single trait

Author(s)

Rich FitzJohn


Make colours transparent

Description

Make colours transparent

Usage

util_colour_set_opacity(col, opacity = 0.5)

Arguments

col

Vector of colours

opacity

Vector of opacities

Examples

util_colour_set_opacity("red", seq(0, 1, length.out=6))
util_colour_set_opacity(c("red", "blue"), .5)

Weibull disturbance regime The frequency of disturbance in a meta-population of patches follows a Weibull distribution

Description

Weibull_Disturbance_Regime control object.

Usage

Weibull_Disturbance_Regime(max_patch_lifetime)

Arguments

max_patch_lifetime

Maximum lifetime of a patch, determines length of a simulation