R/nd_classifier.R

Defines functions nd_classifier

Documented in nd_classifier

#' Assign detect/non-detect to sampling data
#'
#' Assign detect flags to data
#'
#' @param x a character vector values
#'
#' @export
#'
#' @details This function assigns detect/non-detect/greater than detect (D/ND/GD) based on the presence of a "<" or ">" flag attached to the sampling result value.
#' Currently, this function is used in conjunction with \code{nd_remover}
#'
#' @examples
#' \dontrun{
#' x <- c('0.24', '>0.25', '2', '>0.5', '<2.5', '<6')
#' nd_classifier(x)
#'
#' x <- c('  0.24', '> 0.25', '2 ', '>.5', '<2.5', '<  6')
#' nd_classifier(x)
#' }
#'
#' @return Returns a character vector
#'
#' @seealso \code{nd_remover}
#'
#' @author Julie Padilla
#'
#' @concept wrangling
#'
nd_classifier <- function(x){
  ifelse(grepl('<', x), "ND", ifelse(grepl('>', x), "GD", "D"))
}
LimnoTech/limnotools documentation built on May 17, 2019, 9:10 a.m.