[R] Error in axis ????

Duncan Murdoch murdoch.duncan at gmail.com
Thu Nov 10 11:37:20 CET 2011


On 11-11-09 10:34 PM, eric wrote:
> I did an update of both rstudio and my packages. I had some trouble but was
> able to move a lot of the packages so most troubles seem to be behind me.
> But having a problem with code that previously ran fine. See below:
>
> require(quantmod)
> Loading required package: quantmod
> Loading required package: Defaults
> Loading required package: xts
> Loading required package: zoo
>
> Attaching package: ‘zoo’
>
> The following object(s) are masked from ‘package:base’:
>
>      as.Date, as.Date.numeric
>
> Loading required package: TTR
>> require(rdatamarket)
> Loading required package: rdatamarket
>> rm(list=ls())
>> g
>> <-dmlist("http://datamarket.com/data/set/1jz5/st-louis-financial-stress-index#display=line&ds=1jz5")
>> g$Date<-as.Date(g[,1], "%Y-%m-%d")
>> h<-as.xts(g, order.by=g[,1])
>> j<-h[,2]
>> s<-getSymbols('^GSPC', from="1990-01-01", to=Sys.Date())
>> s<-to.weekly(GSPC)
>> s<-s[,6]
>> x<-na.omit(merge(s,j)) ; names(x)<-c("sp","stress")
>> print(head(x))
>                 sp stress
> 1993-12-31 466.45 -0.453
> 1994-01-07 469.90 -0.442
> 1994-01-14 474.91 -0.435
> 1994-01-21 474.72 -0.449
> 1994-01-28 478.70 -0.462
> 1994-02-04 469.81 -0.513
>> par(mfrow=c(2,1))
>> plot(x[,1]/400, ylim=c(-1,5), col="blue")
> Error in axis(1, at = xycoords$x, labels = FALSE, col = "#BBBBBB", ...) :
>    formal argument "col" matched by multiple actual arguments
>> lines(x[,2], col="red")
>> ccf(drop(x[,1]), drop(x[,2]))
>
> How do I fix the error ?

First, find it.  Use traceback() to see the stack at the time of the 
call.  Presumably you or one of the packages you're using has replaced 
plot(), or a function that it calls, and that's the problem.  Look 
through the stack trace to find the culprit.  You can use getAnywhere() 
to retrieve the functions and to report when there are multiple copies 
that might be confusing you.

Duncan Murdoch



More information about the R-help mailing list