R中的整数与数字数据类型

Integer vs Numeric Datatype in R

This is a question I had while going through R programming course from Coursera. I had asked this question in their forums, but didn't get any answer.

所以我想,我应该在这里问一下。

据我了解教授在那次讲座中所说的内容 - 默认情况下,当我们将任何数字值存储在变量中时,如下所示

x <- 1
x

# prints numeric
class(x)

但是为什么当我们存储如下所示的向量时(注意:仍然没有'L'符号强制它为整数)

x <- 1:10
x

# prints "integer", but why?
class(x)

我以为它应该给我一个数值向量,但事实并非如此。

谁能解释一下这里发生了什么?

这个已经讨论过了,见http://r.789695.n4.nabble.com/Integer-vs-numeric-td847329.html 来自 help(":")

Value:

     For numeric arguments, a numeric vector.  This will be of type
     'integer' if 'from' is integer-valued and the result is 
     representable in the R integer type, otherwise of type '"double"'
     (aka 'mode' '"numeric"').