Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: MK_dPCIIC - least-cost - trying to get slot "crs" from an object of a basic class ("character") with no slots #14

Open
SergioRoa1 opened this issue May 17, 2023 · 0 comments

Comments

@SergioRoa1
Copy link

Hi!

I have been using the MK_dPCIIC function to estimate connectivity.

I am trying to use least cost distance but I keep getting the following error:

"Error in cost_distances(x = nodes, id = id, LCD = if (type == "least-cost") { :
trying to get slot "crs" from an object of a basic class ("character") with no slots"

Here is the code I am running:

relictos = shapefile("Relictos.shp")
relictos2 = as(relictos,"sf")
resistanceR = raster("quality_out_c_Daypus_2.tif")
plot(resistanceR)
PC <- MK_dPCIIC(nodes = relictos2,attribute = NULL,
distance = list(type = "least-cost", resistance = "resistanceR"),
metric = "PC", probability = 0.05,
distance_thresholds = 1000)

Do you know why it raises this error, and how I can fix it?

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant