You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Well, this is a history lesson. quantmod:::as.zoo.data.frame was added in c2f9916, on 2007-07-01. The zoo package did not have an as.zoo.data.frame method until 2010-08-03.
The error is because the quantmod method has a row.date argument and also assumes that the data.frame rownames should always be used for the order.by argument. I think the solution is to simply call the zoo constructor if the user provides an order.by argument to the as.zoo call.
> git diff R/quantmod.Rdiff --git a/R/quantmod.R b/R/quantmod.R
index 93dbc7f..11c21ca 100644
--- a/R/quantmod.R+++ b/R/quantmod.R@@ -12,8 +12,12 @@ function(x)
`as.zoo.data.frame`<-
function(x,row.date=TRUE,...)
{
+ # ignore row.date if order.by is specified+ if(hasArg(order.by)) {+ zoo(x,...)+ }
#really need to test order - ???how?
- if(row.date) {+ else if(row.date) {
zoo(x,as.Date(rownames(x),origin='1970-01-01'),...)
}
else {
Description
The function call from the tile stops working after loading quantmod, see MWE
Expected behavior
No interference with as.zoo()
Minimal, reproducible example
Session Info
The text was updated successfully, but these errors were encountered: