I have the same problem where I have to apply the same function to multiple dataframe (sp_list). Here the problem seems not solved. Can you please help me with that?
I should apply this function bg <- sample_background( data = sp, x = "x", y = "y", n = 100, method = "biased", rlayer = regions, maskval = 1, rbias = sampbias, sp_name = sp )
I tried with
allsp <-list.files(pattern = "\\.csv$", full.names = TRUE)
sp_list <- vector("list", length(allsp)) |> setNames(basename(allsp))
my_function <- function(sp_plist)
sample_background(
data = sp_list,
x = "x",
y = "y",
n = 100,
method = "biased",
rlayer = regions,
maskval = 1,
rbias = sampbias,
sp_name = sp_list
)
bg <- lapply(sp_list,my_function)