select_factor_count_strictly_positive: Select data based on the number of prescences per category

Description Usage Arguments Examples

View source: R/select_factor_count_strictly_positive.R

Description

Prescences have Count > 0.

Usage

1
2
select_factor_count_strictly_positive(observation, variable, threshold,
  relative = FALSE, dimension = 1)

Arguments

observation

the data.frame with observations

variable

the name of the factor

threshold

the minimal threshold

relative

When FALSE the threshold is the number of non-zero observations. When TRUE the threshold is the proportion of non-zero observations. Defaults to FALSE.

dimension

indicates which element of variable is used for the final aggregation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
observation <- data.frame(
  Count = c(4, 4, 4, 4, 3, 3, 3, 0, 2, 2, 0, 0),
  LocationID = rep(1:3, each = 4),
  Year = rep(c(1, 1, 1, 1, 2, 2), 2)
)
# Select the locations with at least 3 prescenses
select_factor_count_strictly_positive(observation, variable = "LocationID", threshold = 3)
# Select those locations in which the species is present in at least 2 years
select_factor_count_strictly_positive(
  observation, variable = c("LocationID", "Year"), threshold = 2
)
# Select those years in which the species is present in at least 2 locations
select_factor_count_strictly_positive(
  observation, variable = c("LocationID", "Year"), threshold = 2, dimension = 2
)

INBO-Natura2000/n2kanalysis documentation built on Oct. 5, 2018, 8 a.m.