R - as function
Articles Related
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
> 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