1、判断数据类型
a <- 1:4
class(a)
is.numeric(a)
is.vector(a)
is.character(a)
is.logical(a)
is.array(a)
is.data.frame(a)
is.matrix(a)
is.factor(a)
2、转换数据类型
a <- 1:4
as.numeric(a)
as.character(a)
as.vector(a)
as.matrix(a)
as.data.frame(a)
as.factor(a)
as.logical(a)
原文:https://www.cnblogs.com/liujiaxin2018/p/14692770.html