GISSM_kill_seedling: Set seedling as dead for a given day in a given year ('ss1s')

View source: R/RcppExports.R

GISSM_kill_seedlingR Documentation

Set seedling as dead for a given day in a given year (‘ss1s’)

Description

Set seedling as dead for a given day in a given year (‘ss1s’)

Usage

GISSM_kill_seedling(ss1s, ry_year_day, ry_useyrs, y, doy)

Arguments

ss1s

Logical vector. Elements represent calendar days included in all calendar year of ry_useyrs.

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.

Note

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.

C code

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)

References

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.

Examples

 # 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
   }


DrylandEcology/rSW2funs documentation built on June 28, 2023, 2:51 a.m.