I would like to get only one curve that is the "average" of all curves in order to get the "average trend". In my specific case, it is to average simulations I made.
Using this tutorial (cf the code below) , I managed to get multiple curves like this :
Here is the code to get the plot above :
set.seed(06062023)
my_values = list(rnorm(10),rnorm(10),rnorm(10),rnorm(10),rnorm(10),
rnorm(10),rnorm(10),rnorm(10),rnorm(10),rnorm(10))
den<-lapply(my_values, density)
plot(den[[1]], ylim=c(0,0.8), xlim=c(-6,6),main='Densities altogether')
for(i in 2:length(den)){
lines(den[[i]], col=i)
}


weightsargument in thedensityfunction.