Pearson Correlation in R

Hi everyone!

I need to do pearson correlation with two datatables. The data are:
Table 1 I have my biological information and table 2 I have the environmental information. I want to correlation this information. I tried to use cor.test (a,b, method = "pearson"). But it doesn't work. Somebody can help me?


Hi. What does your data look like? Can you provide a reproducible example?

a and b are columns in the data frame or vectors and they need to be of the same length.

william|, thanks for aswer! I put below a exemplo of my data:

Family S1 S2 S3
Acetobacteraceae 29 19 35
Acidimicrobiaceae 46 40 46
Bradyrhizobiaceae 16 6 8
Burkholderiaceae 34 22 31
Caulobacteraceae 1 5 0
Chitinophagaceae 24 14 23
Comamonadaceae 148 181 168
Flavobacteriaceae 20 16 28
Gaiellaceae 20 19 20
Hymenobacteraceae 44 39 50
Samples N total NH+4 NO-3 C.O M.O
S1 231 14 32 34 59
S2 210 98 39 24 42
S3 196 126 67 23 39

These are my two data table: The first table I have bacterial families and number of sequences of them. And the second table I have the physical parameters. As you can see, the samples in table 1 and 2 are the same, but I want correlate the biological data (families) with environmental data.

Thanks a lot,


Thanks a lot!

I don't think correlation is what you need for this problem and don't think it will work. You might need a different sort of test.

I assume that you want to figure out if the bacterial families are related to the physical parameters.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.