R/na_drop.R

Defines functions na.drop

Documented in na.drop

#' Remove NA values
#'
#' Removes missing values from a dataset.
#'
#' @param xin A numeric vector.
#' @returns A vector without missing values
#' @author Richard Murray Lark <murray.lark@@nottingham.ac.uk>
#' @export
#' @keywords internal
#' @examples
#' x<-evapotranspiration$`ET(mm)`
#' na.drop(x)
#'
na.drop<-function(xin){
  noNA<-as.numeric(length(which(is.na(xin)==T)))
  if(noNA>0){
    x<-as.numeric(na.omit(xin))
    message(paste(noNA," missing value(s) removed"))
  }else{
    x<-xin
  }
  return(x)
}

Try the BLA package in your browser

Any scripts or data that you put into this service are public.

BLA documentation built on May 29, 2024, 10:32 a.m.