This must be very simple, but I can't seem to find the solution. I need to compare the Close
value for 2 xts
objects
I have 2 xts
objects:
>low2
low2 daco.Close
2013-07-24 6.63
>low3
low3 daco.Close
2013-07-24 2.63
But when I try something like this
if(low2$daco.Close < low3$daco.Close) {...}
I keep getting the error
Error in if (low2$daco.Close < low3$daco.Close) { :
argument is of length zero
Even though when I try print(low2)
or print(low3)
I get the correct values.
Any tip on how to solve this will be much appreciated. Thanks!
Edit:
Following are the outputs of low2
and low3
> dput(low2)
structure(6.63, .indexCLASS = "Date", tclass = "Date", .indexTZ = "UTC", tzone = "UTC", src = "xxx", updated = structure(1374782893.98805, class = c("POSIXct",
"POSIXt")), class = c("xts", "zoo"), index = structure(1374451200, tzone = "UTC", tclass = "Date"), .Dim = c(1L,
1L), .Dimnames = list(NULL, "daco.Close"))
> dput(low3)
structure(2.63, .indexCLASS = "Date", tclass = "Date", .indexTZ = "UTC", tzone = "UTC", src = "xxx", updated = structure(1374782893.98805, class = c("POSIXct",
"POSIXt")), class = c("xts", "zoo"), index = structure(1374624000, tzone = "UTC", tclass = "Date"), .Dim = c(1L,
1L), .Dimnames = list(NULL, "daco.Close"))