R/trait.check.R

Defines functions dp.spp dp.count

Documented in dp.count dp.spp

#' Check the data for repeats and errors
#' @name trait.check
#' @description basic checking functions for morphology data to see if ids match spp, misspellings etc.
#' @param x Dataset to be parsed
#' @param ids specimen id numbers that you want to check otherwise all in x
#' @details NONE
#' @return the value of the identified statistic
#' @author Matthew R. Helmus
# @examples None None
#' @seealso None None
#' @references None None
#' @rdname trait.check
#' @export


dp.spp<-function(x,ids=NULL){
  if(!is.null(ids))
  {
    xx<-x[!is.na(match(x$specimen.id.number, ids)),]
  } else {
    xx<-x
  }
  return(rowSums(table(xx$specimen.id.number,xx$species)>0))
}

#' @rdname trait.check
#' @export

dp.count<-function(x,ids=NULL){
  if(!is.null(ids))
  {
    xx<-x[!is.na(match(x$specimen.id.number, ids)),]
  } else {
    xx<-x
  }
  return(rowSums(table(xx$count,xx$specimen.id.number)>0))
}
mrhelmus/ieco documentation built on May 23, 2019, 7:37 a.m.