Re: [R] List to Array: How to establish the dimension of the array

2012-01-26 Thread Brian Diggs
Please include the context of the discussion in your responses. See inline below. On 1/24/2012 11:33 PM, Ajay Askoolum wrote: Thanks you, I can get the length of aa with length(unlist(aa)). If aa has 4 dimensions, I imagine I'd need to do max(sapply(aa,sapply,sapply,length) Correct. How

Re: [R] List to Array: How to establish the dimension of the array

2012-01-25 Thread Rui Barradas
Hello, If you just want the dimensions of the array, and assuming the input list will give a rectangular array with no need to use NA's, the function below works. (It doesn't construct the array) aa - list(list(list(1:4), list(5:8), list(9:12)),

Re: [R] List to Array: How to establish the dimension of the array

2012-01-24 Thread Brian Diggs
On 1/24/2012 2:47 PM, Ajay Askoolum wrote: Given a variable aa in the workspace, some of its attributes are: typeof(aa) [1] list mode(aa) [1] list length(aa) [1] 2 How do I retrieve the maximum indices, in this case 2,3,4? The variable itself is: aa [[1]] [[1]][[1]] [[1]][[1]][[1]]

Re: [R] List to Array: How to establish the dimension of the array

2012-01-24 Thread Ajay Askoolum
Thanks you, I can get the length of aa with length(unlist(aa)). If aa has 4 dimensions, I imagine I'd need to do max(sapply(aa,sapply,sapply,length) How can I do this in a generic way? That is in a loop. I am clear about the exit condition for the loop. d-1 start loop if d =