R/missValVec.R

Defines functions missValVec

Documented in missValVec

#'missValVec
#' @param vec1 a vector to be compared
#' @param vec2 a vector to be compared
#' @return missValVec returns a vector containing the values of \code{vec1} missing in \code{vec2} i.e. the values present in \code{vec1} but not in \code{vec2}. If the missing values are all numeric then the output vector is of class numeric. If at least one of the missing values is a character, then the output vector is of class character.
#' @description missValVec takes as input two vectors (\code{vec1} and \code{vec2}) and returns a vector containing the values present in the first vector but not in the second vector.
#' @examples
#' missValVec(c(1,2,"a"),c(2,"a",3,4,5))
#' missValVec(c(1,2,"dog",10,"apple"),c(11,22,"dog",2,"orange"))
#' @export
missValVec<-function(vec1,vec2)
{
  missValVector<-vec1[c(which(is.na(match(vec1,vec2))))]

  return(missValVector)
}
lwTools/agriTrf documentation built on March 26, 2020, 12:09 a.m.