I have a list:
l <- list(1:3, 4:6)
names(l[[1]]) <- c("A1","B1","C1")
names(l[[2]]) <- c("A2","B2","C2")
l
[[1]]
A1 B1 C1
1 2 3
[[2]]
A2 B2 C2
4 5 6
I would like to switch my list element's value and name, so the output like this:
[[1]]
1 2 3
A1 B2 C3
[[2]]
4 5 6
A2 B2 C2
In my real list, I have 200 + sublist and each sublist have 100+ element. Is there any efficient way can achieve this in R?
Thank you in advance.