title: Error to perform Collinearity with findCorrelation () function (creation SDM)
body: <p>I'm trying to create a species distribution model (SDM) with the presence-absence methodology. I have done all the necessary steps (below the complete code of one of the interested species).
  To do this, I downloaded the 19 bioclimatic variables from WorldClim and made a crop of Europe, excluding Russia.
  However I need to do the collinearity to exclude the correlated variables.
  The problem is that when I go to search correlations, it returns me an empty dataframe (data not available)(the empty dataframe is &quot;Vars_to_removemin&quot; at the end of code).
  I have already used these codes and they have not created any problems for me, does anyone know a way to perform the collinearity of the data in a different way or do they know why they give me this error?
  Below is the complete and fully reproducible code (5 minutes to reproduce.
  Thank you if you will help me, i hope you have a good day and good job!</p>
  <pre><code>library(raster)
  library(dismo)
  library(dplyr)
  library(rnaturalearth)
  library(caret)
  
  
  #Import data miniopterus
  minio&lt;- gbif(&quot;Miniopterus&quot;, &quot;schreibersii&quot; , download=T)
  
  
  #Filter data miniopterus
  
  minio&lt;- minio%&gt;%
    filter(!is.na(lat))%&gt;%
    filter(!is.na(lon))%&gt;%
    filter(year&gt;1980)%&gt;%
    filter(basisOfRecord %in% c(&quot;HUMAN_OBSERVATION&quot;, &quot;OBSERVATION&quot;))
  
  
  #Create miniogeo (lon, lat)
  miniogeo&lt;-minio%&gt;%
    select(lon,lat)
  head(miniogeo)
  
  miniogeo$species&lt;-1
  coordinates(miniogeo) &lt;-c(&quot;lon&quot;,&quot;lat&quot;)
   
  
  #set  crs
  crs(miniogeo) &lt;- &quot;+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs&quot;
  proj4string(miniogeo) &lt;- CRS(&quot;+init=epsg:4326&quot;)
  
  #Worlclim data and Europe map
  Europe &lt;- ne_countries(scale=&quot;medium&quot;, type=&quot;map_units&quot;, returnclass=&quot;sf&quot;, continent=&quot;Europe&quot;)
  
  Worldclim&lt;-raster::getData('worldclim', var='bio', res=2.5) 
  
  Europe &lt;- Europe %&gt;%
    dplyr::select(geometry,name_long)  %&gt;%  
    filter(name_long!='Russian Federation')
  
  envData&lt;-crop(Worldclim, Europe)
  EuropePred &lt;- mask(envData, Europe) 
  
  
  #sample 5000
  set.seed(999)
  
  minio5000&lt;- miniogeo%&gt;%
    as.data.frame()%&gt;%
    sample_n(5000)
  
  coordinates(minio5000) &lt;-c(&quot;lon&quot;,&quot;lat&quot;)
  
  crs(minio5000) &lt;- &quot;+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs&quot;
  proj4string(minio5000) &lt;- CRS(&quot;+init=epsg:4326&quot;)
  
  
  #(Re)create a dataframe miniopterus
  xypMinio&lt;-as.data.frame(minio5000,row.names = NULL) 
  
  
  #Absences miniopterus
  colnames(xypMinio) &lt;- c(&quot;x&quot;,&quot;y&quot;,&quot;presence&quot;)
  
  sample_abxy&lt;- randomPoints(EuropePred, 12500, p=minio5000)
  
  
  #dataframe uniti pres/abs
  sample_abxydf&lt;-as.data.frame(sample_abxy)
  sample_abxydf$presence&lt;-0
  
  minPresAbs&lt;-rbind(sample_abxydf, xypMinio)
  
  #predictors
  predictors_min&lt;- raster::extract(EuropePred, minPresAbs[,1:2], df=T)
  predictors_min&lt;- predictors_min[,-1]
  
  crs(minPresAbs)&lt;-crs(EuropePred)
  
  #collineary test
  Vars_to_removemin &lt;- data.frame(BIO=findCorrelation(cor(predictors_min), cutoff = .6, names = T))
  intersection1 &lt;- colnames(predictors_min) %in% Vars_to_removemin$BIO
  
  #remove the intersection
  predictors_min &lt;- predictors_min[!intersection1]
  sdmData_min&lt;- data.frame(pres =minPresAbs[,1], predictors_min[1:ncol(predictors_min)]) 
  
  </code></pre>