Re: [R] How to doulbe all the value on a matrix

2011-01-17 Thread David Winsemius
You have the capability of using the Nabble interface to post plain text. I have checked. There is a little button above your composition frame that lets you change to plain text. On Jan 17, 2011, at 4:38 PM, André Dias wrote: OK!! So, the ideia is from the 1st matrix get the 2nd matrix

Re: [R] How to doulbe all the value on a matrix

2011-01-17 Thread ADias
Pete Brecknock wrote: > > try ... > > new_m = m[c(2,7,8),c(1,4,6,7)] > > HTH > > Pete > Hi Pete, I haven't understood what you wanted to say here. Can you explain please? thanks ADias -- View this message in context: http://r.789695.n4.nabble.com/How-to-doulbe-all-the-value-on-a-matrix-

Re: [R] How to doulbe all the value on a matrix

2011-01-17 Thread André Dias
OK!! So, the ideia is from the 1st matrix get the 2nd matrix with the use of a vector. is it possible? In the example I have a 10x10 matrix and I get from that one a second 4x3 matrix selected from a vector. thanks ADias 2011/1/17 David Winsemius > > On Jan 17, 2011, at 11:16 AM, ADias wrot

Re: [R] How to doulbe all the value on a matrix

2011-01-17 Thread David Winsemius
On Jan 17, 2011, at 11:16 AM, ADias wrote: Hi, yes it works perfectly. I have another question: Is there way of selecting with a vector the values I wish to take out from a matrix. Example: I have this matrix and I want to take out the numbers in bold and get the second matrix below

Re: [R] How to doulbe all the value on a matrix

2011-01-17 Thread Pete Brecknock
I believe you want to select a subset of rows and subset of columns of your original matrix m. If you had wanted only the first row of m, you could have used m[1,] Alternatively, if you had wanted only the second column of m then you could have used m[,2] m[1,2] would give you the element at

Re: [R] How to doulbe all the value on a matrix

2011-01-17 Thread ADias
Hi, yes it works perfectly. I have another question: Is there way of selecting with a vector the values I wish to take out from a matrix. Example: I have this matrix and I want to take out the numbers in bold and get the second matrix below >m [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,

Re: [R] How to doulbe all the value on a matrix

2011-01-17 Thread Pete Brecknock
try ... new_m = m[c(2,7,8),c(1,4,6,7)] HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/How-to-doulbe-all-the-value-on-a-matrix-tp3221213p3221234.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-proje

Re: [R] How to doulbe all the value on a matrix

2011-01-17 Thread Dieter Menne
ADias wrote: > > Is there an expression to double the values of a matrix - without using a > loop? > > Why so complicated? Dieter > m = matrix(rep(1,20),nrow=4) > m [,1] [,2] [,3] [,4] [,5] [1,]11111 [2,]11111 [3,]11111 [4,]

[R] How to doulbe all the value on a matrix

2011-01-17 Thread ADias
Hi, Is there an expression to double the values of a matrix - without using a loop? What I need is this: Suppose we have this matrix > m [,1] [,2] [,3] [1,]7 174 [2,] 11 10 18 [3,] 15 19 18 and I want this matrix [,1] [,2] [,3] [1,] 112 102 115

Re: [R] How to doulbe all the value on a matrix

2011-01-17 Thread Pete Brecknock
typo ... should have been m = matrix(c(7,11,15,17,10,19,4,18,18), nrow = 3, ncol=3) sum_m = sum(m) new_m = sum_m-m -- View this message in context: http://r.789695.n4.nabble.com/How-to-doulbe-all-the-value-on-a-matrix-tp3221213p3221216.html Sent from the R help mailing list archive at Nabble

Re: [R] How to doulbe all the value on a matrix

2011-01-17 Thread Pete Brecknock
If I have understood your question correctly, how about the following ... m = matrix(c(7,11,15,17,10,19,4,18,18), nrow = 3, ncol=3) sum_m = sum(m) new_m = summ-m HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/How-to-doulbe-all-the-value-on-a-matrix-tp3221213p3221215