[R] how to reverse a list

Weiwei Shi helprhelp at gmail.com
Wed Apr 11 23:19:06 CEST 2007


Hi, there:

I am wondering if there is a quick way to "reverse" a list like this:

t0 <- list(a=1, b=1, c=2, d=1)

reverst t0 to t1

> t1
$`1`
[1] "a" "b" "d"

$`2`
[1] "c"


thanks.
-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

"Did you always know?"
"No, I did not. But I believed..."
---Matrix III



More information about the R-help mailing list