R - as function

> Procedural Languages > R

Table of Contents

2 - Example

> x = 0:3
> class(x)
[1] "integer"
> as.logical(x)
[1] FALSE  TRUE  TRUE  TRUE
> as.character(x)
[1] "0" "1" "2" "3"
> as.numeric(x)
[1] 0 1 2 3
> as.complex(x)
[1] 0+0i 1+0i 2+0i 3+0i