Newdata <- read.csv(file = "D:/Jeremiah/Grouped_data.csv")
#print(Newdata)
# print number of columns
print (ncol(Newdata))
## [1] 9
# print number of rows
print(nrow(Newdata))
## [1] 120148
# select numeric variables
df <- dplyr::select_if(Newdata, is.numeric)
head(df,6)
## precip_month_avg elevation_m_0buff temperature_month_avg_0km Count.of.Species
## 1 1.09252 1038.542 34.73000 4
## 2 1.09252 1038.542 36.88000 4
## 3 1.09252 1038.542 32.47500 4
## 4 1.09252 1038.542 42.71667 4
## 5 1.09252 1038.542 38.91000 4
## 6 1.09252 1038.542 30.67000 4
# calulate the correlations
r <- cor(df, use="complete.obs")
round(r,2)
## precip_month_avg elevation_m_0buff
## precip_month_avg 1.00 0.16
## elevation_m_0buff 0.16 1.00
## temperature_month_avg_0km -0.22 -0.58
## Count.of.Species -0.08 -0.09
## temperature_month_avg_0km Count.of.Species
## precip_month_avg -0.22 -0.08
## elevation_m_0buff -0.58 -0.09
## temperature_month_avg_0km 1.00 0.09
## Count.of.Species 0.09 1.00
library(ggplot2)
library(ggcorrplot)
ggcorrplot(r)

ggcorrplot(r,
hc.order = TRUE,
type = "lower",
lab = TRUE)
