Message-ID: <CADvcS_nxfSQJi-WGiFKyi5xNrmnF66qTB4ko=ObzwKASfVwuaQ@mail.gmail.com>
Date: 2023-09-26T11:54:29Z
From: Konstantinos Papakostas
Subject: Error in ENFA Analysis with Distance Variables
Dear Forum Members,
I hope this message finds you well. I'm currently working in R Studio with
the adehabitatHS package to conduct an Ecological Niche Factor Analysis
(ENFA) for analyzing chamois habitat selection. While working on my
analysis, I've encountered an issue related to the inclusion of distance
variables, specifically, distances to the nearest road, path, and escape
terrain. I calculated these distances using the distanceto package.
Here's a brief overview of my workflow:
1.
I used the extract function from the terra package to obtain the values
of various environmental variables (e.g., Elevation, TRI, Habitat types,
etc.) for each observation.
2.
I then combined these extracted values into a data frame using the
data.frame function.
3.
Next, I created a SpatialPixelsDataFrame with the following code:
variables_pix <- SpatialPixelsDataFrame(locs, variables_dataframe,
tolerance = 0.999933, proj4string = "+proj=longlat +ellps=WGS84
+datum=WGS84 +no_defs")
*locs is a SpatialPoints
Now, when I attempt to calculate the pr object using the count.points
function, I encounter the following error message:
Error in count.points(locs, variables_pix) : the cellsize should be
the same in x and y directions.
Could someone please advise on what might be causing this issue?
I also have all the variables as rasters with the same extent and
resolution, but not the distances (class: numeric).
Any guidance or suggestions would be greatly appreciated. Thank you in
advance for your help.
Kind regards, Kostas
[[alternative HTML version deleted]]