pairs(airquality[,c('Ozone','Solar.R', 'Wind', 'Temp')]) # scatter plot
cor(airquality[, c("Ozone", "Solar.R", "Wind", "Temp")],
use = "complete.obs") # use the rows where there is both a value for x and y
Ozone Solar.R Wind Temp
Ozone 1.0000000 0.3483417 -0.6124966 0.6985414
Solar.R 0.3483417 1.0000000 -0.1271835 0.2940876
Wind -0.6124966 -0.1271835 1.0000000 -0.4971897
Temp 0.6985414 0.2940876 -0.4971897 1.0000000