numeric(length=0) is.numeric(x) as.numeric(x)
is.numeric returns TRUE if x has mode "numeric", and FALSE otherwise. Its behavior is unaffected by any attributes of x; for example, x could be a numeric array (in contrast to the behavior of is.vector).
as.numeric returns a vector like x, but with storage mode "double", if x is a simple object of mode "numeric". Otherwise, as.numeric returns a numeric object of the same length as x and with data resulting from coercing the elements of x to mode "numeric".
There is a difference between coercing to a simple object of mode "numeric" and setting the mode attribute: mode(myobject) <- "numeric" This changes the mode of myobject but leaves all other attributes unchanged (so a matrix stays a matrix, e.g.). The value of as.numeric(myobject) has no attributes.
The class of simple objects have no attributes. In most S-PLUS expressions it is not necessary to explicitly ensure that data are of a particular mode.
z <- numeric(length(zz)) # double object same length as zz Results are currently computed to single-precision accuracy only. amp;.Fortran("mydsub",as.double(xm))