as.data 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 Dumped> 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) > is.na(x) [1] F F F T