Check whether a vector of ages consists in single ages. This makes sense sometimes when age intervals are not explicitly given.
is_single(Age)
| Age | integer. Vector of age classes. |
|---|
logical. TRUE if detected as single ages, FALSE otherwise.
In cases where ages are indeed single, but repeated, this will still return FALSE.
Therefore make sure that the age vector given refers to a single year of a single population.
Age <- 0:99 Age2 <- c(0:10,0:10) Age3 <- seq(0,80,by=5) Age4 <- seq(0,10,by=.5) is_single(Age) # TRUE#> [1] TRUEis_single(Age2) # FALSE repeated, can't tell.#> [1] FALSEis_single(Age3) # FALSE not single ages#> [1] FALSEis_single(Age4) # FALSE not single ages#> [1] FALSE