什么是矢量?

Pen*_*eng 0 r

有一个data.frame

> x

        date  open  high   low close   volume adjusted  
1 2010-01-04 24.52 24.58 23.68 23.71 24192200    23.71  
2 2010-01-05 23.75 23.90 22.75 23.30 55649900    23.30  
3 2010-01-06 23.25 23.25 22.72 22.90 41214300    22.90  
4 2010-01-07 22.90 23.05 22.40 22.65 35533600    22.65  
5 2010-01-08 22.50 22.75 22.35 22.60 28854300    22.60  
6 2010-01-11 23.50 23.68 22.28 22.60 44284600    22.60

> is.vector(x[,1])
[1] FALSE  
> is.vector(x[,2])
[1] TRUE  
> is.vector(x[,1])
[1] FALSE 
> is.vector(x[,3])
[1] TRUE  
> is.vector(x[,4])
[1] TRUE  
> is.vector(x[,5])  
[1] TRUE  
> is.vector(x[,6])
[1] TRUE  
> is.vector(x[,7])
[1] TRUE  
Run Code Online (Sandbox Code Playgroud)

我想知道为什么is.vector(x[,1])不是真的?

Ari*_*man 6

来自?is.vector:

如果x是指定模式的向量而没有名称以外的属性,则is.vector返回TRUE.否则返回FALSE.

您的第一列可能存储为日期类.因此,如果您获得其属性(使用str()),您将看到它具有除名称之外的一些属性.