# R command for computing karl pearson and Spearman coefficient
x=c(15,16, 19,17,17,15,18,16,18,18)
y=c(10, 12,12,13,11,9,11,13,11,12)
r=cor(x, y,method="pearson")# can mention method if you like but by default cor do karl pearson
R=cor(x, y, method="spearman")
cat('karl pearson coefficient=',r)
cat('\nSpearman=',R)
print("both type is moderate positive correlation")
# remember karl pearson and spearman say same thing only method is different
#value is different but range which both falls under are same
To embed this project on your website, copy the following code and paste it into your website's HTML: