NewUsr_stat
NewUsr_stat

Reputation: 2573

Pearson’s correlation test

I have a situation like this:

Gene       SAMPLE1   SAMPLE2 
 G1         0.33      0.21  
 G2         0.45      0.324 
 G3         0.765     0.654 
 G4         0.98      0.543 
 G5         0.565     0.13
 G6         0.123     0.943
 G7         0.321     0.572
....       ...       ......

data are not real data. i need to: compute the p-values of a two sided Pearson’s correlation test.

Can anyone help me please? I'm quite new in R.

Upvotes: 0

Views: 341

Answers (2)

A. Kassambara
A. Kassambara

Reputation: 228

As said above you can use the cor.test() function:

 cor.test(data$SAMPLE1, data$SAMPLE2)

If you are a beginner in R, correlation test between two variables is extensively described here :

http://www.sthda.com/english/wiki/correlation-test-between-two-variables

You can also do pearson correlation test online without any installation here :

http://www.sthda.com/english/rsthda/correlation.php

Upvotes: 0

Paul Hiemstra
Paul Hiemstra

Reputation: 60924

You can use cor.test to peform this correlation test. This is part of any standard R distribution. In your case with(dat, cor.test(Sample1, Sample2)) will perform the test you need.

Googling for R correlation test returned the documentation of cor.test as the first result.

Upvotes: 2

Related Questions