Correlation in R

The variable hosp1 has 2 columns: Latitude and Longitude. We want to see if the pairs of data share a correlation, i.e. is there a relationship between Latitude and Longitude? Does increasing the first variable affect the second variable?

  • A positive correlation means as Variable 1 increase Variable 2 increases
  • A negative correlation means as Variable 1 increases Variable 2 decreases
  • No correlation mean that increasing Variable 1 has no general effect on Variable 2
[1] -0.1113144

So the function is


And hosp1$Latitude is the Latitude column and hosp1$Longitude is the Longitude column

Categorised as Data, R