Re: [R] R matrix help

2012-06-14 Thread Jeff Newmiller
X4, if it is 20, dim=5X4. >please help me do this. > >Thank you >Regards >karthick > >-- >View this message in context: >http://r.789695.n4.nabble.com/R-matrix-help-tp4633372.html >Sent from the R help mailing list archive at Nabble.com. > >___

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
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 context: http://r.789695.n4.nabble.com/R-matrix-help-tp4633372.html Sent from the R help mailing list archive at Nabble.com

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
you > Regards > karthick > > -- > View this message in context: > http://r.789695.n4.nabble.com/R-matrix-help-tp4633372.html > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@r-project.org maili

[R] R matrix help

2012-06-14 Thread karthicklakshman
context: http://r.789695.n4.nabble.com/R-matrix-help-tp4633372.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] matrix help (first occurrence of variable in column)

2011-05-19 Thread jim holtman
Is this what you are looking for: > mdat3 sp.1 sp.2 sp.3 sp.4 sp.5 T110010 T210010 T311100 T410111 > > # create a matrix of when species first appeared > first <- apply(mdat3, 2, function(x) (cumsum(x == 1) > 0) + 0

Re: [R] matrix help (first occurrence of variable in column)

2011-05-19 Thread Michael Denslow
On Wed, May 18, 2011 at 9:49 PM, jim holtman wrote: > Is this what you were after: > >> mdat <- matrix(c(1,0,1,1,1,0), nrow = 2, ncol=3, byrow=TRUE, > +               dimnames = list(c("T1", "T2"), > +                               c("sp.1", "sp.2", "sp.3"))) >> >> mdat >   sp.1 sp.2 sp.3 > T1    

Re: [R] matrix help (first occurrence of variable in column)

2011-05-18 Thread jim holtman
Is this what you were after: > mdat <- matrix(c(1,0,1,1,1,0), nrow = 2, ncol=3, byrow=TRUE, + dimnames = list(c("T1", "T2"), + c("sp.1", "sp.2", "sp.3"))) > > mdat sp.1 sp.2 sp.3 T1101 T2110 > # do 'rle' on each column and see

[R] matrix help (first occurrence of variable in column)

2011-05-18 Thread Michael Denslow
Dear R help, Apologies for the less than informative subject line. I will do my best to describe my problem. Consider the following matrix: mdat <- matrix(c(1,0,1,1,1,0), nrow = 2, ncol=3, byrow=TRUE, dimnames = list(c("T1", "T2"), c("sp.1", "sp.2", "

Re: [R] Matrix Help

2011-02-20 Thread Mark Knecht
On Sun, Feb 20, 2011 at 2:56 PM, Dmitry Berman wrote: > On Sun, Feb 20, 2011 at 5:55 PM, Dmitry Berman wrote: > >> Listers, >> >> I have a simple matrix: >> >> -- >> m <-c(1:7) >> m <- cbind(m) >> >> m >> [1,] 1 >> [2,] 2 >> [3,] 3 >> [4,] 4 >> [5,] 5 >> [6,] 6 >>

Re: [R] Matrix Help

2011-02-20 Thread David Winsemius
On Feb 20, 2011, at 5:56 PM, Dmitry Berman wrote: On Sun, Feb 20, 2011 at 5:55 PM, Dmitry Berman wrote: Listers, I have a simple matrix: -- m <-c(1:7) m <- cbind(m) m [1,] 1 [2,] 2 [3,] 3 [4,] 4 [5,] 5 [6,] 6 [7,] 7 --- I

Re: [R] Matrix Help

2011-02-20 Thread Dmitry Berman
On Sun, Feb 20, 2011 at 5:55 PM, Dmitry Berman wrote: > Listers, > > I have a simple matrix: > > -- > m <-c(1:7) > m <- cbind(m) > > m > [1,] 1 > [2,] 2 > [3,] 3 > [4,] 4 > [5,] 5 > [6,] 6 > [7,] 7 > --- > > I want to add a second co

[R] Matrix Help

2011-02-20 Thread Dmitry Berman
Listers, I have a simple matrix: -- m <-c(1:7) m <- cbind(m) m [1,] 1 [2,] 2 [3,] 3 [4,] 4 [5,] 5 [6,] 6 [7,] 7 --- I want to add a second column using: [[alternative HTML version deleted]] ___

Re: [R] matrix help

2010-09-26 Thread Remko Duursma
I think you want ?solve ... Remko -- View this message in context: http://r.789695.n4.nabble.com/matrix-help-tp2714378p2714896.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/ma

[R] matrix help

2010-09-26 Thread purna
Anyone know how write a function that solves: (1 + c)x1 +x2 +x3 = 5 x1+(1 + c)x2+x3 = 5 + 2c x1+x2 +(1 + c)x3= 5 + 3c, where c is a small constant, for 1000 equidistant values c = (10^-14, 2*10^-14, ..