append_lP {lefko3} | R Documentation |
Append Projections Into New lefkoProj Object
Description
Function append_lP()
combines two population projections. It takes
two lefkoProj
objects and appends them into a new lefkoPrpoj
object.
Usage
append_lP(proj1 = NULL, proj2 = NULL)
Arguments
proj1 |
A |
proj2 |
A second |
Value
A list of class lefkoProj
, which always includes the first
three elements of the following, and also includes the remaining elements
below when a lefkoMat
object is used as input:
projection |
A list of lists of matrices showing the total number of
individuals per stage per occasion. The first list corresponds to each
pop-patch followed by each population (this top-level list is a single
element in |
stage_dist |
A list of lists of the actual stage distribution in each occasion in each replicate in each pop-patch or population. |
rep_value |
A list of lists of the actual reproductive value in each occasion in each replicate in each pop-patch or population. |
pop_size |
A list of matrices showing the total population size in each
occasion per replicate (row within data frame) per pop-patch or population
(list element). |
labels |
A data frame showing the order of populations and patches in
item |
ahstages |
The original stageframe used in the study. |
hstages |
A data frame showing the order of historical stage pairs. |
agestages |
A data frame showing the order of age-stage pairs. |
labels |
A short data frame indicating the population (always |
control |
A data frame showing the number of replicates and time steps corresponding to each set of projections, where each set corresponds to a pop-patch within the labels object of each input projection. |
density |
The data frame input under the density option. Only provided if input by the user for at least one of the two projections. Output as a nested list corresponding to each pop-patch - replicate. |
density_vr |
The data frame input under the density_vr option. Only provided if input by the user for at least one of the two projections. Output as a nested list corresponding to each pop-patch - replicate. |
Notes
lefkoProj
objects resulting from previous appends can also be
appended.
See Also
Examples
data(cypdata)
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)
cypraw_v1 <- verticalize3(data = cypdata, noyears = 6, firstyear = 2004,
patchidcol = "patch", individcol = "plantid", blocksize = 4,
sizeacol = "Inf2.04", sizebcol = "Inf.04", sizeccol = "Veg.04",
repstracol = "Inf.04", repstrbcol = "Inf2.04", fecacol = "Pod.04",
stageassign = cypframe_raw, stagesize = "sizeadded", NAas0 = TRUE,
NRasRep = TRUE)
cypsupp2r <- supplemental(stage3 = c("SD", "P1", "P2", "P3", "SL", "D",
"XSm", "Sm", "SD", "P1"),
stage2 = c("SD", "SD", "P1", "P2", "P3", "SL", "SL", "SL", "rep", "rep"),
eststage3 = c(NA, NA, NA, NA, NA, "D", "XSm", "Sm", NA, NA),
eststage2 = c(NA, NA, NA, NA, NA, "XSm", "XSm", "XSm", NA, NA),
givenrate = c(0.1, 0.2, 0.2, 0.2, 0.25, NA, NA, NA, NA, NA),
multiplier = c(NA, NA, NA, NA, NA, NA, NA, NA, 0.5, 0.5),
type = c(1, 1, 1, 1, 1, 1, 1, 1, 3, 3), stageframe = cypframe_raw,
historical = FALSE)
cypmatrix2r_AB <- rlefko2(data = cypraw_v1, stageframe = cypframe_raw,
year = "all", patch = c("A", "B"), stages = c("stage3", "stage2"),
size = c("size3added", "size2added"), supplement = cypsupp2r,
yearcol = "year2", patchcol = "patchid", indivcol = "individ")
cypmatrix2r_AC <- rlefko2(data = cypraw_v1, stageframe = cypframe_raw,
year = "all", patch = c("A", "C"), stages = c("stage3", "stage2"),
size = c("size3added", "size2added"), supplement = cypsupp2r,
yearcol = "year2", patchcol = "patchid", indivcol = "individ")
cypproj1 <- projection3(cypmatrix2r_AB, nreps = 5, times = 15,
stochastic = TRUE)
cypproj2 <- projection3(cypmatrix2r_AC, nreps = 10, times = 20,
stochastic = TRUE)
cypproj3 <- append_lP(cypproj1, cypproj2)