[R] Reducing dimension of a list object

Ivan Calandra ivan.calandra at uni-hamburg.de
Tue Apr 19 17:16:53 CEST 2011


Hi,

Would unlist() do what you want?
unlist(lis3)
[1] 4 1 8

HTH,
Ivan

Le 4/19/2011 17:32, Bogaso Christofer a écrit :
> Hi all, I generally use the Reduce() function to reduce the dimension of
> list object. However in my current session I have few objects which are
> actually list of list of list..(say n step). If I reduce their dimension
> then I have call Reduce() function many times. Therefore my question is, is
> there any 1-step way to reduce the dimension at the lowest level? Take this
> example:
>
>
>
> lis1<- list(4)
>
> lis2<- list(1,8)
>
> lis3<- list(lis1, lis2)
>
>
>
> # Now I want to reduce the dimension of lis3 to a column vector:
>
>
>
>> Reduce("c", Reduce("c", lis3))
> [1] 4 1 8
>
>
>
> I want to have some mechanism so that I need not to call reduce() function
> twice. Is there any way to do that?
>
>
>
> Thanks and regards,
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>

-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/1525_8_1.php



More information about the R-help mailing list