You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am new to SDM and also using spThin package. I have this line of code:
##############################################################################
#Clean up!
rm(list=ls())
head(DataSpecies)
Aspiliaafricana country Code X_WGS84 Y_WGS84
1 1 BJ 6.650 2.600
2 1 BJ 9.100 1.933
3 1 BJ 6.416 2.616
4 1 BJ 9.350 1.400
5 1 BJ 6.883 1.600
6 1 BJ 9.350 1.450
##############################################################################
I get this error:
Beginning Spatial Thinning. Script Started at: Mon Mar 4 09:55:26 2024Error in .subset2(x, i, exact = exact) : attempt to select less than one element in get1index
Can anyone help with guidiance on how to resolve it
The text was updated successfully, but these errors were encountered:
Hi @tosinaregbs2 , it looks to me like the problem is coming from how your are defining your species column. As I see it here, it looks like you've created a column titled Aspiliaafricana, and then forced the elements of that column to be numbers.
Hi @mlammens, I have replaced the numbers in the species column with the species name and also tried suggestions from previous from your responses to similar questions. One of the suggestion is to convert to degrees. I have converted to degrees (to be sure it is). I also varied the thin.par., but the error persists. Thanks for your support.
I am new to SDM and also using spThin package. I have this line of code:
##############################################################################
#Clean up!
rm(list=ls())
load the required packages
library(spThin)
read data ----
species occurrences data
DataSpecies <- read.csv("C:/Users/tosin/OneDrive/Documents/SDM proo/AspilaAfricana1.csv", stringsAsFactors = FALSE)
head(DataSpecies)
Select the name of the studied species
myRespName <- 'Aspiliaafricana'
Get corresponding presence/absence data
myResp <- as.numeric(DataSpecies[, myRespName])
Get corresponding XY coordinates
myRespXY_pre <- DataSpecies[, c('X_WGS84', 'Y_WGS84')]
#Remove NAs
acgeo <- subset(myRespXY_pre, !is.na(X_WGS84) & !is.na(Y_WGS84))
Define thinning parameters
thin_par <- 0.5
reps <- 10
Thin the data
thinned_data <- thin(
loc.data = acgeo,
lat.col = "Y_WGS84",
long.col = "X_WGS84",
spec.col = "myRespName",
thin.par = thin_par,
reps = reps,
write.files = TRUE,
out.base = "thinned_data_",
verbose = TRUE
)
Print information about the thinned data
print(thinned_data)
#############################################################################
Can anyone help with guidiance on how to resolve it
The text was updated successfully, but these errors were encountered: