79575506

Date: 2025-04-15 15:15:53
Score: 8
Natty:
Report link

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)
Reasons:
  • Blacklisted phrase (1): help me
  • Blacklisted phrase (1): I have the same problem
  • RegEx Blacklisted phrase (3): Can you please help me
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Me too answer (2.5): I have the same problem
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Valentina Todisco