Dieter is correct, the lengths of the 2 series are different
Try
s = merge(s1,s2)
corr = cor(s[,"Close.s1"],s[,"Close.s2"],use="pairwise.complete.obs")
print(corr)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Finding-the-correlation-coefficient-of-two-stocks
veepsirtt wrote:
>
> corr <- cor(s1,s2)
> Error in cor(s1, s2) : incompatible dimensions
>
>
Check lenghts of your series.
cor(c(1,2),c(1,2,3))
#Error in cor(c(1, 2), c(1, 2, 3)) : incompatible dimensions
Dieter
--
View this message in context:
http://r.789695.n4.nabble.com/Finding-t
2 matches
Mail list logo