Skip to content
Prev 197877 / 398500 Next

How apply a function to a list while maintaining list name?

I use lapply to apply a function to the list 'L'. But of course, the
list names in 'X' is not maintained. I'm wondering if there is a
function that can maintain the list names as well as apply the
function.

$ Rscript lapply.R
$x
[1] "a" "b"

$y
[1] "a" "b"
[[1]]
[1] "ab"

[[2]]
[1] "ab"
$x
[1] "ab"

$y
[1] "ab"