Thanks David, that went perfectly fine.
Best
Tom
--
View this message in context:
http://r.789695.n4.nabble.com/Correlation-Loops-in-time-series-tp4672732p4672879.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org m
lp-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of TMiller
Sent: Wednesday, July 31, 2013 8:16 AM
To: r-help@r-project.org
Subject: [R] Correlation Loops in time series
Hello, I've got the following problem.
I have to matrices each containing 200 time series
Hello, I've got the following problem.
I have to matrices each containing 200 time series.
Now I want to calculate the correlation of the first time series of each of
the matrices.
I use the following command:
cor(mts1[,1],mts2[,1], use="complete.obs", method=c("pearson"))
cor(mts1[,2],mts2[,2], us
Hi,
May be this helps:
set.seed(25)
mt1<- matrix(sample(c(NA,1:40),20*200,replace=TRUE),ncol=200)
set.seed(487)
mt2<- matrix(sample(c(NA,1:80),20*200,replace=TRUE),ncol=200)
res<- sapply(seq_len(ncol(mt1)),function(i)
cor(mt1[,i],mt2[,i],use="complete.obs",method="pearson"))
A.K.
Hello,
4 matches
Mail list logo