我有一个动物园“z”。有人可以解释一下为什么加载动物园库后我的请求which(z[2,]>0 & z[1,]>0)
不再起作用吗?
> str(z)
zoo [1:2, 1:12] 0 0 0 0 0 0 0 0 0 0 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : NULL
- attr(*, "index")=Classes 'dates', 'times' atomic [1:2] 17531 17562
.. ..- attr(*, "format")= chr "m/d/y"
.. ..- attr(*, "origin")= Named num [1:3] 1 1 1970
.. .. ..- attr(*, "names")= chr [1:3] "month" "day" "year"
> which(z[2,]>0 & z[1,]>0)
[1] 12
> library(zoo)
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
> which(z[2,]>0 & z[1,]>0)
integer(0)
对于那些感兴趣的人:
> dput(z)
structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0.00996714478550151, 0.00996009385006366), .Dim = c(2L,
12L), .Dimnames = list(NULL, NULL), index = structure(c(17531,
17562), format = "m/d/y", origin = structure(c(1, 1, 1970), .Names = c("month",
"day", "year")), class = c("dates", "times")), class = "zoo")