x <- 1L # 整数类型(integer)
y <- 2 # 数值类型(numeric)
# 将整数类型转换为数值类型:
a <- as.numeric(x)
# 将数值类型转换为整数类型:
b <- as.integer(y)
# 打印 x 和 y 的值
x
y
# 打印 a 和 b 的数据类型名称
class(a)
class(b)