R/UNI.R

#' remove repeated rows from data frame so stipulated variable value is unique.
#' this is useful to produce concise data frame after using \code{ave()} to get means/sds.
#'
#' \code{UNI(frame,varcol)}
#'
#'
#' @param \code{frame} name of the data frame.
#' @param \code{varcol} is the column number of the variable which is to be unique


UNI=function(frame,varcol){
  NEW=frame[order(frame[,varcol]),]
  NEWER=NEW[1,]
  for(a in 2:nrow(NEW)){
    if(NEW[a,varcol]!=NEW[a-1,varcol]) NEWER=rbind(NEWER,NEW[a,])
  }
  return(invisible(NEWER))
}
helophilus/ColsTools documentation built on May 30, 2019, 4:03 p.m.