Access and preserve list names in lapply function
I believe that lapply by default keeps the names attribute of whatever you are iterating over. When you store the names of myList in n, that vector no longer has any “names”. So if you add that back in via, names(n) <- names(myList) and the use lapply as before, you should get the desired result. … Read more