[R] Reducing dimension of a list object

From: Bogaso Christofer <bogaso.christofer_at_gmail.com>
Date: Tue, 19 Apr 2011 21:02:16 +0530

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. Received on Tue 19 Apr 2011 - 15:10:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 19 Apr 2011 - 15:20:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive