I am asking for your R skills' support. For one of my papers, I am modelling the distribution of tree species in Amazonia using remote sensing variables (LT band 3, 4, 5, 7, DEM and NDVI) and I am planning to mask out all the sites out of the "convex hull" of my predictors. I have reviewed several packages and functions in R (convhull, convhulln) but without success.
I have extracted all the variables' values of more than 6000 presence points. I need to do a convex hull to that set of points and then take it to the geographical space and then mask everything out. So basically I need a raster file with NAs and 1s (NAs areas out of the convex hull and 1s areas within the convex hull)
dbase <-read.csv("dbase.csv")
names(dbase)
# [1] "id" "pca" "block" "strip" "tree.n" "plaque"
# [7] "species" "diameter" "height" "volume" "x" "y"
# [13] "condition" "sector"
coordinates(dbase)<-~x+y
files <- list.files("C:/Users/...",
pattern="asc", full.names=TRUE )
predictors <-stack(files) # b3, b4, b5, b7, ndvi and dem
presence_var <-extract(predictors,dbase)
# B3 B4 B5 B7 DEM ndvi
# [1,] 25 75 57 18 349 0.5000000
# [2,] 22 79 64 19 332 0.5643564
# [3,] 24 79 62 20 336 0.5339806
# [4,] 23 79 62 20 341 0.5490196
# [5,] 25 80 63 21 307 0.5238096
# [6,] 24 83 63 20 342 0.5514019
# ...
conhull <-convHull(presence_var)
pr <- predict(conhull, predictors)
plot(pr) # empty results
Any suggestions?