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 max = FALSE, no threshold will be examined. If max = TRUE, a threshold cutoff needs to be provided where rows containing more than the cutoff will be removed from the data frame.

cutoff

The threshold number where rows containing more unusable observations than the cutoff will be removed from the data frame.

above_cutoff

If above_cutoff = TRUE, the data frame returned will be the rows containing more unusable observations than the cutoff. If above_cutoff = FALSE the data frame returned will be the rows containing equal to or less unusable observations than the cutoff.

rm_unusable

If rm_unusable = TRUE, the columns named in the unusable vector will be removed from the data frame. These columns will not be removed if rm_unusable = FALSE, though duplicate data will remain.

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)

[Package quadcleanR version 1.1.0 Index]