Rev 24300 | Rev 30825 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{numeric}\title{Numeric Vectors}\alias{numeric}\alias{as.numeric}\alias{is.numeric}\usage{numeric(length = 0)as.numeric(x, \dots)is.numeric(x)}\arguments{\item{length}{desired length.}\item{x}{object to be coerced or tested.}\item{\dots}{further arguments passed to or from other methods.}}\description{\code{numeric} creates a real vector of the specified length. Theelements of the vector are all equal to \code{0}.\code{as.numeric} attempts to coerce its argument to numeric type(either integer or real).\code{is.numeric} returns \code{TRUE} if its argument is of type realor type integer and \code{FALSE} otherwise.}\details{\code{is.numeric} is generic: you can write methods to handleof specific classes of objects, see \link{InternalMethods}.Note that factors are false for \code{is.numeric} but true for\code{\link{is.integer}}.}\note{\emph{\R has no single precision data type. All real numbers arestored in double precision format}. While \code{as.numeric} is ageneric function, user methods must be written for \code{as.double},which it calls\code{as.numeric} for factors yields the codes underlying the factorlevels, not the numeric representation of the labels.}\references{Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)\emph{The New S Language}.Wadsworth \& Brooks/Cole.}\examples{as.numeric(c("-.1"," 2.7 ","B")) # (-0.1, 2.7, NA) + warningas.numeric(factor(5:10))}\keyword{classes}\keyword{attribute}