I am getting an error "Error in statistic(data, original, ...) : unused argument (original)"
when trying to execute the code below. Specifically, I am trying to apply a function and bootstrap those results for each plot#. Am I missing something straightforward here?
library(codyn) # has sample dataset called pplots
library(boot)
str(pplots)
stability <- function(x){
mean(multivariate_change(x,
species.var = "species",
time.var = "year",
abundance.var = "relative_cover",
replicate.var = "plot")$composition_change)
}
boot_obj <- lapply(splitspplots,boot,statistic = stability,R = 20)
boot_obj <- lapply(splitspplots,myBootFun)
myBootFun <- function(x,i) {
lapply(x[i],boot, statistic=stability, R = 10)
}
myBootFun <- function(x,i) {
boot(x[i], statistic=stability, R = 10)
}
splitspplots <- split(pplots,pplots$plot)
lapply(splitspplots, print(myBootFun))