Dear list,

I have a list, as follows :

a <- 5
names(a) <- "a"
b <- 9
names(b) <- "b"
c <- 15
names(c) <- "c"
x <- list("i" = a, "j" = b, "j" = c)

I want to invert the list, like this :

$a
i
5

$b
j  k
9 15

I do not find a clean solution.

Could anyone give me elegant ideas ?

Thanks in advance,
Carlos

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to