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-tp3246992p3247261.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@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.

Reply via email to