[R] Overriding contributed package functions

Richard Saba sabaric at auburn.edu
Thu Mar 5 17:51:37 CET 2009


The  "tsdiag" function in the TSA package overrides the "tsdiag" function in
the "stats" package. There are a few annoying bugs in the TSA's version of
the function so I would like to use the "stats" function but still have
access to other TSA functions.  I have tried using  stats::tsdiag( ) but as
long as the TSA package is attached the function from the "TSA" package is
called. I believe the problem is the result of the TSA package not having a
"namespace". The only solution I have found is to detach the TSA package,
(detach("package:TSA")) , which results in the loss of all the TSA specific
functions.  Does anyone have another solution?
The following code illustrates the problem:

Y1<-arima.sim(n=100,list(ar=c(.95,-0.2)))
model1<-arima(Y1,order=c(2,0,0)) 
tsdiag(model1)
library(TSA)                                            
tsdiag(model1)
stats::tsdiag(model1)
detach("package:TSA")   
tsdiag(model1)

R Saba



More information about the R-help mailing list