Learn R Programming

lefko3 (version 3.1.0)

sf_create: Create a Stageframe for Population Matrix Projection Analysis

Description

sf_create() returns a data frame describing each ahistorical life history stage in the life history model. This data frame can be used as input into MPM creation functions such as flefko3(), where it determines how each stage is treated during matrix estimation.

Usage

sf_create(
  sizes,
  stagenames = NA,
  repstatus = 1,
  obsstatus = 1,
  propstatus = NA,
  immstatus = NA,
  matstatus = 1,
  minage = NA,
  maxage = NA,
  indataset = NA,
  binhalfwidth = 0.5,
  ipmbins = 100,
  roundsize = 5
)

Arguments

sizes

A numeric vector of the typical or representative size of each life history stage.

stagenames

An optional vector of stage names, in the same order as elements in sizes. If an IPM or function-based matrix with many stages is desired, then two stages that occur within the dataset and represent the lower and upper size limits of the IPM must be marked as ipm in this vector. These stages must be mature stages, and should have all characteristics other than size equal. If two or more groups of stages, each with its own characteristics, are to be developed for an IPM, then an even number of stages with two stages marking the minimum and maximum size of each group should be marked, with all other characteristics equal within each group.

repstatus

A vector denoting the binomial reproductive status of each life history stage. Defaults to 1.

obsstatus

A vector denoting the binomial observation status of each life history stage. Defaults to 1, but may be changed for unobservable stages.

propstatus

A vector denoting whether each life history stage is a propagule. Such stages are generally only used in fecundity estimation. Defaults to NA.

immstatus

A vector denoting whether each stage is immature. Must be composed of binomial values if given. Defaults to NA.

matstatus

A vector denoting whether each stage is mature. Must be composed of binomial values if given. Defaults to 1 for all stages defined in sizes.

minage

An optional vector denoting the minimum age at which a stage can occur. Only used in age x stage matrix development. Defaults to NA.

maxage

An optional vector denoting the maximum age at which a stage should occur. Only used in age x stage matrix development. Defaults to NA.

indataset

A vector designating which stages are found within the dataset. While rlefko2() and rlefko3() can use all stages in the input dataset, flefko3() and flefko2() can only handle size-classified stages with non-overlapping combinations of size and reproductive status, plus one immature stage. Stages that do not actually exist within the dataset should be marked as 0 in this vector.

binhalfwidth

A numeric vector giving the half-width of size bins. Required to classify individuals appropriately within size classes. Defaults to 0.5 for all sizes.

ipmbins

If an IPM is desired, then this parameter sets the number of stages to create for that IPM. This number is in addition to any stages that are not size-classified. Defaults to 100, and numbers greater than this yield a warning about the loss of statistical power and increasing chance of matrix over-parameterization resulting from increasing numbers of stages.

roundsize

This parameter sets the precision of size classification, and equals the number of digits used in rounding sizes. Defaults to 5.

Value

A data frame of class stageframe, which includes information on the stage name, size, reproductive status, observation status, propagule status, immaturity status, maturity status, presence within the core dataset, counts of similarly sized stages, raw bin half-width, and the minimum, center, and maximum of each size bin, as well as its width. If minimum and maximum ages were specified, then these are also included. Also includes an empty string variable that can be used to describe stages meaningfully. This object can be used as the stageframe input for flefko3() flefko2(), rlefko3(), and rlefko2().

Variables in this data frame include the following:

stagenames

The unique names of the stages to be analyzed.

size

The typical or representative size at which each stage occurs.

repstatus

A binomial variable showing whether each stage is reproductive.

obsstatus

A binomial variable showing whether each stage is observable.

propstatus

A binomial variable showing whether each stage is a propagule.

immstatus

A binomial variable showing whether each stage can occur as immature.

matstatus

A binomial variable showing whether each stage occurs in maturity.

indataset

A binomial variable describing whether each stage occurs in the input dataset.

binhalfwidth_raw

The half-width of the size bin, as input.

min_age

The minimum age at which the stage may occur.

max_age

The maximum age at which the stage may occur.

sizebin_min

The minimum size at which the stage may occur.

sizebin_max

The maximum size at which the stage may occur.

sizebin_center

The centroid of the size bin at which the stage may occur.

sizebin_width

The width of the size bin corresponding to the stage.

comments

A text field for stage descriptions.

Examples

Run this code
# NOT RUN {
sizevector <- c(0, 0, 0, 0, 0, 0, 1, 2.5, 4.5, 8, 17.5)
stagevector <- c("SD", "P1", "P2", "P3", "SL", "D", "XSm", "Sm", "Md", "Lg", 
                 "XLg")
repvector <- c(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
obsvector <- c(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
matvector <- c(0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
immvector <- c(0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0)
propvector <- c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
indataset <- c(0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
binvec <- c(0, 0, 0, 0, 0, 0.5, 0.5, 1, 1, 2.5, 7)

cypframe_raw <- sf_create(sizes = sizevector, stagenames = stagevector,
                          repstatus = repvector, obsstatus = obsvector,
                          matstatus = matvector, propstatus = propvector,
                          immstatus = immvector, indataset = indataset,
                          binhalfwidth = binvec)

cypframe_raw$comments[(cypframe_raw$stagenames == "SD")] <- "Dormant seed"
cypframe_raw$comments[(cypframe_raw$stagenames == "P1")] <- "1st yr protocorm"
cypframe_raw$comments[(cypframe_raw$stagenames == "P2")] <- "2nd yr protocorm"
cypframe_raw$comments[(cypframe_raw$stagenames == "P3")] <- "3rd yr protocorm"
cypframe_raw$comments[(cypframe_raw$stagenames == "SL")] <- "Seedling"
cypframe_raw$comments[(cypframe_raw$stagenames == "D")] <- "Dormant adult"
cypframe_raw$comments[(cypframe_raw$stagenames == "XSm")] <- "Extra small adult (1 shoot)"
cypframe_raw$comments[(cypframe_raw$stagenames == "Sm")] <- "Small adult (2-3 shoots)"
cypframe_raw$comments[(cypframe_raw$stagenames == "Md")] <- "Medium adult (4-5 shoots)"
cypframe_raw$comments[(cypframe_raw$stagenames == "Lg")] <- "Large adult (6-10 shoots)"
cypframe_raw$comments[(cypframe_raw$stagenames == "XLg")] <- "Extra large adult (>10 shoots)"

cypframe_raw
# }

Run the code above in your browser using DataLab