I have a loop within which I am processing some models results.
rpp <- 100
sim_names <- c("25","50","75")
for(sc in 1:length(sim_names)){
for(rp in 1:rpp){
outputs <- list.files(dir, paste0("modelname",sim_names[sc],"_",rp))
results <- function(outputs)
results is for each simulation a matrix with 31 columns that are my model parameters and line as the number of values simulated with a MCMC for each parameter.
What I want is to extract means and standard deviation from each parameters of each matrix and store it in a list within the loop. Also, I would like to iterate it through the parameters (results' columns names), I started like this but it won't work:
results_stat <- list()
for (p in colnames(results)) {
results_stat[[p]][sc,rp] <- mean(results[, p])
results_stat[[p]][sc,rp] <- sd(results[, p])
}#p
}#rp
}#sc
Thank you!