How do I calculate the Pearson correlation coefficient in R?

You can use the cor() function to calculate the Pearson correlation coefficient in R. To test the significance of the correlation, you can use the cor.test() function.