To find the P-value of correlation coefficient in R, you can use cor.test() function in R.

The following method shows how you can do it with syntax.

Method 1: Use cor.test() Function

cor.test(df$column1,df$column2)

The following example shows how to find P-value of correlation coefficient in R using cor.test() function.

Using cor.test() Function

Let’s see how we can use cor.test() function in R:

# Create data frame
df <- data.frame(Pressure1=c(78.2, 88.2, 71.7, 80.21, 84.21, 82.56, 72.12, 73.85),
                 Temperature=c(35, 36, 37, 38, 32, 30, 31, 34),
                 Pressure2=c(12, 13, 11, 12, 14, 15, 13, 15))

# Calculate correlation coefficient and p-value
c <- cor.test(df$Pressure1,df$Pressure2)

# Display correlation coefficient and p-value
print(c)

Output:

Pearson's product-moment correlation

data:  df$Pressure1 and df$Pressure2
t = 0.67598, df = 6, p-value = 0.5242
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.5398497  0.8174562
sample estimates:
     cor 
0.266023 

Here from output we can say correlation coefficient is 0.266023 and p-value is 0.5242 between Pressure1 and Pressure2 column of dataframe.