threshold: To go to higher level in the hierarchy.

View source: R/intensity-classes.R

thresholdR Documentation

To go to higher level in the hierarchy.

Description

This function transforms the current numeric vector or intensity data set into a "simplified black and white image" of this same data set: every value of disease intensity below and above a given threshold is given the value 0 and 1, respectively.

Usage

threshold(data, value, ...)

Arguments

data

A numeric vector or an intensity object.

value

All the intensity values lower or equal to this value are set to 0. The other values are set to 1.

...

Additional arguments to be passed to other methods.

Details

By default, everything above 0 is given 1, and 0 stays at 0. threshold is thus useful to report a whole sampling unit as "healthy" (0), if no diseased individual at all was found within the sampling unit, or "diseased" (1) if at least one diseased individual was found.

Value

A numeric vector or an intensity object.

Examples

my_incidence <- incidence(tomato_tswv$field_1929)
plot(my_incidence, type = "all")
my_incidence_clumped_1 <- clump(my_incidence, unit_size = c(x = 3, y = 3))
plot(my_incidence_clumped_1, type = "all")
my_incidence_thr <- threshold(my_incidence_clumped_1, value = 4)
plot(my_incidence_thr, type = "all")


chgigot/epiphy documentation built on Nov. 20, 2023, 1:13 p.m.