[R] lags and differences

fciclone fciclone at bol.com.br
Tue May 11 20:30:41 CEST 2004


Dear all, could someone please clarify me if this 
works, so as to implement lags and differences for 
example in y and in a independent x1 of a  regression?

model<-lm((diff(y), -i)~x1+lag(x1,-1), data=anydata)


Thanks, a lot,
Alexandre.


---------- Início da mensagem original -----------

      De: r-help-bounces at stat.math.ethz.ch
    Para: r-help at stat.math.ethz.ch
      Cc: 
    Data: Tue, 11 May 2004 15:48:19 +0000 (UTC)
 Assunto: Re: [R] xtable with a table ?

> 
> t. <- table(a,b)
> xtable(format(t.))
> 
> From:   Ian Wilson <I.Wilson at maths.abdn.ac.uk>
> :  
> : Any more elegant solutions to this?
> : 
> : > a <- sample(c("a","d","c"),100,replace=T)
> : > b <- sample(c("d","e","f",100,replace=T)
> : > t <- table(a,b)
> : > xtable(t)
> : Error in xtable(t) : no applicable method 
for "xtable"
> : 
> : The problem is that while t is a table (and
> : hence also a matrix)
> : 
> : > is.matrix(t)
> : [1] TRUE
> : 
> : data.frame(t) produces
> : 
> : > data.frame(t)
> : a b Freq
> : 1 1 1 12
> : 2 2 1 12
> : 3 3 1 7
> : 4 1 2 8
> : 5 2 2 12
> : 6 3 2 11
> : 7 1 3 13
> : 8 2 3 17
> : 9 3 3 8
> : 
> : After a horrible solution, I have 
> : ct <- apply(t,2,cbind);
> : rownames(ct) <- rownames(t);
> : xtable(ct)
> : 
> : Is this a bug/feature, and if so how do I get round 
it?
> : 
> : Ian Wilson
> :
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-
project.org/posting-guide.html
> 
 
__________________________________________________________________________
Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br/




More information about the R-help mailing list