[R] Dimensions of a List
Hi R, I have a list, l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) l [[1]] [[1]][[1]] [1] 1 2 [[1]][[2]] [1] 4 5 [[1]][[3]] [1] 6 7 [[2]] [[2]][[1]] [1] 11 22 33 [[2]][[2]] [1] 44 55 66 How do I know the dimensions of this list?... In other words, how many sub-lists, sub-sub-lists etc...are there in l? How do I know this? Thanks in advance Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@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.
Re: [R] Dimensions of a List
Hi, Shubha Vishwanath Karanth wrote: l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) How do I know the dimensions of this list?... In other words, how many sub-lists, sub-sub-lists etc...are there in l? How do I know this? l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) str(l) List of 2 $ :List of 3 ..$ : num [1:2] 1 2 ..$ : num [1:2] 4 5 ..$ : num [1:2] 6 7 $ :List of 2 ..$ : num [1:3] 11 22 33 ..$ : num [1:3] 44 55 66 I hope this is what you were looking for? Best, Roland __ R-help@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.
Re: [R] Dimensions of a List
Is this what you want? l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) str(l) List of 2 $ :List of 3 ..$ : num [1:2] 1 2 ..$ : num [1:2] 4 5 ..$ : num [1:2] 6 7 $ :List of 2 ..$ : num [1:3] 11 22 33 ..$ : num [1:3] 44 55 66 On 3/25/08, Shubha Vishwanath Karanth [EMAIL PROTECTED] wrote: Hi R, I have a list, l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) l [[1]] [[1]][[1]] [1] 1 2 [[1]][[2]] [1] 4 5 [[1]][[3]] [1] 6 7 [[2]] [[2]][[1]] [1] 11 22 33 [[2]][[2]] [1] 44 55 66 How do I know the dimensions of this list?... In other words, how many sub-lists, sub-sub-lists etc...are there in l? How do I know this? Thanks in advance Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@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.
Re: [R] Dimensions of a List
Thanks a lot for your reply...Exactly...I need the same...But can I store these numbers and hence can access further? In other words how do I extract the numbers/dimensions from this class? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: jim holtman [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 9:21 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Dimensions of a List Is this what you want? l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) str(l) List of 2 $ :List of 3 ..$ : num [1:2] 1 2 ..$ : num [1:2] 4 5 ..$ : num [1:2] 6 7 $ :List of 2 ..$ : num [1:3] 11 22 33 ..$ : num [1:3] 44 55 66 On 3/25/08, Shubha Vishwanath Karanth [EMAIL PROTECTED] wrote: Hi R, I have a list, l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) l [[1]] [[1]][[1]] [1] 1 2 [[1]][[2]] [1] 4 5 [[1]][[3]] [1] 6 7 [[2]] [[2]][[1]] [1] 11 22 33 [[2]][[2]] [1] 44 55 66 How do I know the dimensions of this list?... In other words, how many sub-lists, sub-sub-lists etc...are there in l? How do I know this? Thanks in advance Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@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.
Re: [R] Dimensions of a List
Maybe something like this: lis - lapply(l, lapply, length) names(lis) - lapply(l, length) On 25/03/2008, Shubha Vishwanath Karanth [EMAIL PROTECTED] wrote: Thanks a lot for your reply...Exactly...I need the same...But can I store these numbers and hence can access further? In other words how do I extract the numbers/dimensions from this class? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: jim holtman [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 9:21 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Dimensions of a List Is this what you want? l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) str(l) List of 2 $ :List of 3 ..$ : num [1:2] 1 2 ..$ : num [1:2] 4 5 ..$ : num [1:2] 6 7 $ :List of 2 ..$ : num [1:3] 11 22 33 ..$ : num [1:3] 44 55 66 On 3/25/08, Shubha Vishwanath Karanth [EMAIL PROTECTED] wrote: Hi R, I have a list, l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) l [[1]] [[1]][[1]] [1] 1 2 [[1]][[2]] [1] 4 5 [[1]][[3]] [1] 6 7 [[2]] [[2]][[1]] [1] 11 22 33 [[2]][[2]] [1] 44 55 66 How do I know the dimensions of this list?... In other words, how many sub-lists, sub-sub-lists etc...are there in l? How do I know this? Thanks in advance Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@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.