Re: [R] R matrix help

2012-06-14 Thread Jeff Newmiller
What makes you think that with 12 elements the dimensions should be 3x4? It seems that 4x3 would be equally valid. In every use of matrices that I have encountered, the dimensions have been relatable to some known quantity from the problem context, and matrix dimensioning has been an exercise i

Re: [R] R matrix help

2012-06-14 Thread Sarah Goslee
Can you explain why n=12 should result in 3x4 instead of 2x6 or 6x2 or 4x3 or 1x12 ? On Thu, Jun 14, 2012 at 8:51 AM, karthicklakshman wrote: > Dear R experts, > > I am interested in getting the dimensions for the matrix dynamically, based > on the the number of elements in a matrix for example.

Re: [R] R matrix help

2012-06-14 Thread David L Carlson
Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of karthicklakshman > Sent: Thursday, June 14, 2012 7:51 AM > To: r-help@r-project.org > Subject: [R] R matrix help > > Dear R experts, > > I am interested in get

Re: [R] R matrix help

2012-06-14 Thread Kehl Dániel
If you have your data in x, you can try something like matrix(x,length(x)/4,4) hth kd 2012.06.14. 14:51 keltezéssel, karthicklakshman írta: Dear R experts, I am interested in getting the dimensions for the matrix dynamically, based on the the number of elements in a matrix for example. if th

Re: [R] R matrix help

2012-06-14 Thread John Kane
PDT) > To: r-help@r-project.org > Subject: [R] R matrix help > > Dear R experts, > > I am interested in getting the dimensions for the matrix dynamically, > based > on the the number of elements in a matrix for example. if the number is > 12, > I should get dim= 3X4,

Re: [R] R matrix help

2012-06-14 Thread Sarah Goslee
But the meaning of a 3x4 table is rather different than the meaning of a 1x12 table. Regardless, you probably want to start with integer factorization, and can read more about implementations in R here (and elsewhere): http://tolstoy.newcastle.edu.au/R/help/05/01/10007.html Sarah On Thu, Jun 14,

Re: [R] R matrix help

2012-06-14 Thread R. Michael Weylandt
But there are multiple shapes for matrices with 12 elements -- how did you get 3x4 ? You also could have had 1x12, 2x6, 3x4, 4x3, 6x2,12x1 If you have an R object, you can use dim() on it. [Or perhaps slightly more robustly, NCOL() and NROW()] Michael On Thu, Jun 14, 2012 at 7:51 AM, karthicklak

[R] R matrix help

2012-06-14 Thread karthicklakshman
Dear R experts, I am interested in getting the dimensions for the matrix dynamically, based on the the number of elements in a matrix for example. if the number is 12, I should get dim= 3X4, if it is 20, dim=5X4. please help me do this. Thank you Regards karthick -- View this message in conte