Hello I want to extract data from points of a raster image using spsample function. The function works well for a fixed number of sample. However, when I try to see for different sample sizes through a for loop I get an error message "Warning message:
In [<-
(*tmp*
, i, value = spsample(HARV.points, n = nsample[i], :
implicit list embedding of S4 objects is deprecated
Here is my code:
# this is my base code
HARV.points <- as(DSM_HARV, "SpatialPixelsDataFrame")
HARV.stratified <- spsample(HARV.points, n = 300, type = "stratified")
# However I want to apply a for loop to for different size of n and get different
nsample<- seq(30,270, 30)
HARV.stratified_list<-list()
for (i in length(nsample)) {
HARV.stratified_list[i]<- spsample(HARV.points, n = nsample[i], type = "stratified")
}
But I am getting this error
Warning message:
In [<-
(*tmp*
, i, value = spsample(HARV.points, n = nsample[i], :
implicit list embedding of S4 objects is deprecated