FW: [R] basic indexing

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Oct 11 10:20:41 CEST 2001


Prof Brian D Ripley <ripley at stats.ox.ac.uk> writes:

> > > y
> > [1] 8 9 2 8 8
> > > lag(y,1)
> > [1] NA 8 9 2 8
> > > lag(y,2)
> > [1] NA NA 8 9 2
> 
> There is of course already a generic function called lag in R (in package
> ts), so overwriting it would not be a good idea.
> 
> Especially since this one has argument n of the opposite sign to the
> generic definition.

...which is Splus compatible, although not desirable. From the Splus
docs:

NOTE:
    
   Logically k should have the opposite sign, but due to its pervasive
   use in other functions, lag remains unchanged. However, the new shift
   function (which calls lag by default) has the more logical
   convention.



-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list