class, typeof, mode

Published onesixx on

R: Types and classes of variables
V <- c(1:6)
L <- c(1:6)
M <- matrix(V, 2,3)
A <- array(V, dim=c(2,1,3))
D <- data.table(a=V, b=M)

V %>% class()  ## "integer"
L %>% class()  ## "integer"
M %>% class()  # "matrix"
A %>% class()  # "array"
D %>% class()  # "data.table" "data.frame"


V %>% typeof() ## "integer"
L %>% typeof() ## "integer"
M %>% typeof() ## "integer"
A %>% typeof() ## "integer"
D %>% typeof() # "list"


V %>% mode()  ## "numeric"
L %>% mode()  ## "numeric"
M %>% mode()  ## "numeric"
A %>% mode()  ## "numeric"
D %>% mode()  # "list"
Categories: R Basic

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x