GISSM_kill_seedling | R Documentation |
Set seedling as dead for a given day in a given year (‘ss1s’)
GISSM_kill_seedling(ss1s, ry_year_day, ry_useyrs, y, doy)
ss1s |
Logical vector. Elements represent calendar days included in
all calendar year of |
ry_year_day |
Numerical vector. Elements represent calendar days and values represent the calendar year of each day. |
ry_useyrs |
Numerical vector. The sequence of calendar year. |
y |
Numerical value. The index of the currently examined calendar year. |
doy |
Numerical value. The index of the currently examined calendar day. |
The Rcpp version of the function is about 270x faster for vectors of length 365 and 12,000x faster for vectors of length 11,000 than the R version. The Rcpp version also reduced the memory footprint by a factor of >> 3080.
Previous name setFALSE_SeedlingSurvival_1stSeason
.
ss1s
is a pointer to the data and the original
vector will get altered; one would need for a deep copy:
LogicalVector out = clone(ss1s)
Schlaepfer, D.R., Lauenroth, W.K. & Bradford, J.B. (2014). Modeling regeneration responses of big sagebrush (Artemisia tridentata) to abiotic conditions. Ecol Model, 286, 66-77.
# The \pkg{Rcpp} function is equivalent to the following R version
kill_seedling_R <- function(ss1s, ry_year_day, ry_useyrs, y,
doy) {
ss1s[ry_year_day == ry_useyrs[y]][doy] <- FALSE
ss1s
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.