usable_obs {quadcleanR} | R Documentation |
Extract usable observations
Description
Sum columns containing unusable observations and remove rows that contain more than the specified cutoff number of unusable points. Helpful if there are annotations that were unidentifiable and you want to remove them from the total usable observations, and you can remove quadrats with too many unusable observations.
Usage
usable_obs(
data,
unusable,
max = FALSE,
cutoff,
above_cutoff = FALSE,
rm_unusable = TRUE
)
Arguments
data |
A data frame with each row representing a sampling unit (ex. a quadrat or photo). |
unusable |
A vector of column names containing unusable observations. |
max |
If |
cutoff |
The threshold number where rows containing more unusable observations
than the |
above_cutoff |
If |
rm_unusable |
If |
Value
A data frame containing summed unusable points.
Examples
#create data set for example
Sites <- as.factor(c("One", "One", "Two", "Two", "Three", "Three"))
Transect <- as.factor(c("1-Shallow", "2-Shallow", "1-Shallow", "2-Shallow",
"1-Shallow", "2-Shallow"))
Acropora.sp <- c(1, 2, 3, 4, 5, 6)
Gardineroseris.sp <- c(6, 1, 2, 3, 4, 5)
Psammocora.sp <- c(5, 6, 1, 2, 3, 4)
Leptastrea.sp <- c(4, 5, 6, 1, 2, 3)
Blurry <- c(3, 4, 5, 6, 1, 2)
Unk <- c(2, 3, 4, 5, 6, 1)
coral_cover <- data.frame(Sites, Transect, Acropora.sp, Gardineroseris.sp,
Psammocora.sp, Leptastrea.sp, Blurry, Unk)
usable_obs(coral_cover, c("Blurry", "Unk"))
usable_obs(coral_cover, c("Blurry", "Unk"), above_cutoff = TRUE)
usable_obs(coral_cover, c("Blurry", "Unk"), rm_unusable = FALSE)
usable_obs(coral_cover, c("Blurry", "Unk"), max = TRUE, cutoff = 8)
usable_obs(coral_cover, c("Blurry", "Unk"), max = TRUE, cutoff = 8, above_cutoff = TRUE)