[R] How to rename the columns of as.table
Uwe Ligges
ligges at statistik.tu-dortmund.de
Mon Dec 3 11:47:56 CET 2012
On 03.12.2012 11:00, Hard Core wrote:
> 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?
names(autocorrelazione2) <- paste("Lag", seq_along(autocorrelazione2))
Uwe Ligges
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list