is. as. type is used to test the data type of a data object. If the data object is a data type object, where data type is any of the data types listed below, type returns TRUE, and returns FALSE otherwise. type changes the data type of a data object.

Both is. and as. can be used for the following data types (with the exception of na which can only be used with is.):

array           Multi-Way Arrays
category        Category
character       Character objects
complex         Complex Valued objects
double          Double Precision objects
factor          Factor objects
function        Function objects
integer         Integer objects
list            List objects
logical         Logical objects
matrix          Matrix objects
na              NA
name            Name objects
null            Null objects
numeric         Numeric objects
single          Single Precision objects
ts              Time Series objects
vector          Vectors

> age_c("10","18","76","65","32")
> age
[1] "10" "18" "76" "65" "32"

> age + 10

Error in age + 10: Non-numeric first operand
> is.numeric(age)

[1] F

> age_as.numeric(age)

> age
[1] 10 18 76 65 32

> age + 10
[1] 20 28 86 75 42

> x_c(1,2,3,NA)
[1] F F F T

Further Reading

Richard A. Becker, John M. Chambers, Allan R. Wilks, The New S Language. A Programming Environmnent for Data Analysis and Graphics, Wadsworth & Brooks/Cole Advanced Books & Software, Pacific Grove, California, 1988, pp. 99-101, 127