[R] How to rename the columns of as.table

Hard Core gioxc at hotmail.it
Mon Dec 3 11:00:20 CET 2012


Hello guys .. I would like to have some help about as.table .

I made a table with the autocorrelations of the returns whit 10 lags and i
get this :

autocorrelazione2 <- as.table(c((cor(r2[-1151,],lag(r2))),(cor(r2[-
c(1151,1150),],lag(r2, k=2))),(cor(r2[- c(1151,1150,1149),],lag(r2,
k=3))),(cor(r2[- c(1151,1150,1149,1148),],lag(r2, k=4))),(cor(r2[-
c(1151,1150,1149,1148,1147),],lag(r2, k=5))),(cor(r2[-
c(1151,1150,1149,1148,1147,1146),],lag(r2, k=6))),(cor(r2[-
c(1151,1150,1149,1148,1147,1146,1145),],lag(r2, k=7))),(cor(r2[-
c(1151,1150,1149,1148,1147,1146,1145,1144),],lag(r2, k=8))),(cor(r2[-
c(1151,1150,1149,1148,1147,1146,1145,1144,1143),],lag(r2, k=9))),(cor(r2[-
c(1151,1150,1149,1148,1147,1146,1145,1144,1143,1142),],lag(r2, k=10)))))
> autocorrelazione2
           A                          B                        C                       
D                         E                       F                      G 
-0.087313283 -0.039602008 -0.036173594 -0.052246520 -0.059179674
-0.041706488  0.031601299 
           H                          I                       J 
-0.005105154  0.016379572  0.058881676 

Now i don't want the names  A,B,C,D ..... etc, but i want to rename it with
: Lag1, Lag2, Lag3 ...
I know that it can be done with fix(autocorrelazione1), but i need somthing
in the initial formula. I tried with dnn=list.names("lag1" , .... , "lag10")
but the names remain the same.
Some help?
Thanks guys



--
View this message in context: http://r.789695.n4.nabble.com/How-to-rename-the-columns-of-as-table-tp4651806.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list