Subset generators

finite_head_prop(x, y, prop_tail = 1)

finite_tail_prop(x, y, prop_head = 1)

finite_tail(x, y, n_tail = sum(is.finite(x) & is.finite(y)))

finite_head(x, y, n_head = sum(is.finite(x) & is.finite(y)))

Arguments

x

An independent variable like depth or cumulative dry mass.

y

A dependent variable that responds exponentially to x.

prop_tail, prop_head

A minimum proportion of finite values that should be included in the output

n_tail, n_head

A minimum number of finite values that should be included in the output

Value

A logical vector that can be used to subset x and y.

Examples

x <- 1:5 y <- c(1, 2, NA, NA, 5) finite_head(x, y, 2)
#> [1] TRUE TRUE FALSE FALSE FALSE
finite_tail(x, y, 2)
#> [1] FALSE TRUE FALSE FALSE TRUE
finite_head_prop(x, y, 0.5)
#> [1] TRUE TRUE FALSE FALSE FALSE
finite_tail_prop(x, y, 0.5)
#> [1] FALSE TRUE FALSE FALSE TRUE