I need to access list names inside the lapply function. I\'ve found some threads online where it\'s said I should iterate through the names of the list to be able to fetch e
Have you looked into llply() from the package plyr?
It does exactly what you are asking for. For each element of a list, apply function, keeping results as a list. llply is equivalent to lapply except that it will preserve labels and can display a progress bar. from ?llply
mylist <- list(foo1=1:10,foo2=11:20)
>names(mylist)
[1] "foo1" "foo2"
newlist<- llply(mylist, function(x) mean(x))
>names(newlist)
[1] "foo1" "foo2"