% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/na.r
\name{is.nonfinite}
\alias{is.nonfinite}
\alias{is.nf}
\alias{anyNF}
\title{Are non-finite values present?}
\usage{
is.nonfinite(x)

is.nf(x)

anyNF(x)
}
\arguments{
\item{x}{\strong{R} object to be tested: the default methods handle atomic vectors.}
}
\value{
For \code{is.nonfinite()} and \code{is.nf()}, a logical vector of the same
length as \code{x}.

For \code{anyNF()}, an integer or real vector of length one with value
the \code{1}-based index of the first non-finite value if any,
otherwise \code{0}.
}
\description{
Tests if a vector contains non-finite values
(\code{Inf}, \code{-Inf}, \code{NaN}, or \code{NA}).
}
\details{
\code{is.nonfinite()} (and alias \code{is.nf()}) check for non-finite
values, returning a logical vector of the same length as \code{x},
whereas \code{anyNF()} returns an index immediately when encountering
a non-finite value.

\code{is.nonfinite()} and \code{anyNF()} are S3 generics, so custom
methods can be defined for different object types.

Similar to \code{is.finite()} semantics, \code{is.nonfinite()} returns all
\code{TRUE} for character and raw vectors, and \code{anyNF()} returns \code{1L}.
}
\note{
For character vectors use \link{is.na} and \link{anyNA}.
}
\examples{
is.nonfinite(1:10)
anyNF(1:10)

is.nonfinite(c(1, 2, NA, 4))
anyNF(c(1, 2, NA, 4))

is.nonfinite(c(1, 2, NaN, 4))
anyNF(c(1, 2, NaN, 4))

is.nonfinite(c(1, 2, Inf, 4))
anyNF(c(1, 2, Inf, 4))

is.nf(c(1, 2, -Inf, 4))
anyNF(c(1, 2, -Inf, 4))
}
\seealso{
\link{is.finite}, \link{is.whole}, \link{anyZchar}, \link{anyWS}
}
