From: Liaw, Andy <andy_liaw_at_merck.com>

Date: Tue 16 Aug 2005 - 01:30:32 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Aug 16 01:37:02 2005

Date: Tue 16 Aug 2005 - 01:30:32 EST

If all vectors in the list have the same length, why not use a matrix? Then
you'd just transpose the matrix if you need to. If you really have to have
it as a list, here's one possibility:

> x <- list("1"=c(a=1, b=2, c=3), "2"=c(a=4, b=5, c=6))

*> x
*

$"1"

a b c

1 2 3

$"2"

a b c

4 5 6

> as.list(as.data.frame(t(matrix(unlist(x), nrow=3))))

$V1

[1] 1 4

$V2

[1] 2 5

$V3

[1] 3 6

Andy

*> From: Jan Hummel
**>
**> Hi.
*

> Can anyone suggest a simple way to re-sort in R a list of

*> vectors of the
**> following form?
**>
**> input
**> $"1"
**> a b c
**> 1 2 3
**> $"2"
**> a b c
**> 4 5 6
**>
**> Output should be something like:
**> "a"
**> "1" 1
**> "2" 4
**> "b"
**> "1" 2
**> "2" 5
**> "c"
**> "1" 3
**> "2" 6
**>
**> I've been futzing with mapply(), outer(), split(), rbind()
**> and so on but
**> haven't found an elegant solution.
**>
**> Thanks,
**> Jan.
**>
**> P.S. E-mailed CCs of posted replies appreciated.
**>
**> ______________________________________________
**> R-help@stat.math.ethz.ch mailing list
**> https://stat.ethz.ch/mailman/listinfo/r-help
**> PLEASE do read the posting guide!
**> http://www.R-project.org/posting-guide.html
**>
**>
*

>

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Aug 16 01:37:02 2005

*
This archive was generated by hypermail 2.1.8
: Sun 23 Oct 2005 - 15:20:06 EST
*