Re: [R] How to flatten a tree (based on list) to a certain depth?

2010-02-03 Thread Steve Lianoglou
On Wed, Feb 3, 2010 at 3:01 PM, Peng Yu wrote: > On Wed, Feb 3, 2010 at 1:47 PM, Bert Gunter wrote: >> -- and you didn't read my reply. > > I did. You said to use a loop. I think flatten a tree to a certain > level shouldn't be done with a loop. Loop is a way used in the > imperative programming

Re: [R] How to flatten a tree (based on list) to a certain depth?

2010-02-03 Thread Peng Yu
-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Peng Yu > Sent: Wednesday, February 03, 2010 11:40 AM > To: r-h...@stat.math.ethz.ch > Subject: Re: [R] How to flatten a tree (based on list) to a certain depth? > > On Wed, Feb 3, 2010 at 12:26 PM, Bert Gunt

Re: [R] How to flatten a tree (based on list) to a certain depth?

2010-02-03 Thread Steve Lianoglou
On Wed, Feb 3, 2010 at 2:37 PM, Peng Yu wrote: > On Wed, Feb 3, 2010 at 12:29 PM, Steve Lianoglou >> Does `unlist(root, recursive=FALSE)` get you what you want? ... > My example has only 2 levels. > > But my questions is not limited to a particular level. The > nonrecursive version flatten the fi

Re: [R] How to flatten a tree (based on list) to a certain depth?

2010-02-03 Thread Peng Yu
. > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Peng Yu > Sent: Wednesday, February 03, 2010 10:20 AM > To: r-h...@stat.math.ethz.ch > Subject: [R] How to flatten a tree (based on list) to a certain depth? > >

Re: [R] How to flatten a tree (based on list) to a certain depth?

2010-02-03 Thread Peng Yu
On Wed, Feb 3, 2010 at 12:29 PM, Steve Lianoglou wrote: > Hi, > > On Wed, Feb 3, 2010 at 1:19 PM, Peng Yu wrote: >> Suppose that I have the following list of lists of frames 'root' >> (let's call it a 'tree' of frames). I want to flatten it to be a list >> of frames. However, if I unlist(root), i

Re: [R] How to flatten a tree (based on list) to a certain depth?

2010-02-03 Thread Steve Lianoglou
Hi, On Wed, Feb 3, 2010 at 1:19 PM, Peng Yu wrote: > Suppose that I have the following list of lists of frames 'root' > (let's call it a 'tree' of frames). I want to flatten it to be a list > of frames. However, if I unlist(root), it will flatten the frames as > well. Is there a simply way to fla

[R] How to flatten a tree (based on list) to a certain depth?

2010-02-03 Thread Peng Yu
Suppose that I have the following list of lists of frames 'root' (let's call it a 'tree' of frames). I want to flatten it to be a list of frames. However, if I unlist(root), it will flatten the frames as well. Is there a simply way to flatten the tree to certain depth? aframe1=data.frame(x=1:3,y=1