[R] How to invert a list ?

Wu Gong wg2f at mtmail.mtsu.edu
Tue Aug 10 22:46:04 CEST 2010


Hi Carlos,

I give a handmade code, hope it helps.

y <- list()
y$a <- a
y$b <- c(b,c)
names(y$a) <- "i"
names(y$b) <- c("j","k")


Carlos Petti wrote:
> 
> a <- 5
> names(a) <- "a"
> b <- 9
> names(b) <- "b"
> c <- 15
> names(c) <- "c"
> x <- list("i" = a, "j" = b, "j" = c)
> 


-----
A R learner.
-- 
View this message in context: http://r.789695.n4.nabble.com/How-to-invert-a-list-tp2320108p2320433.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list