Re: [R] subsetting a matrix and filling other. Solved

2006-11-07 Thread antonio rodriguez
Thanks! Antonio > > >> -Christos >> >> -Original Message- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of antonio rodriguez >> Sent: Tuesday, November 07, 2006 2:01 PM >> To: R-Help >> Subject: [R] subsetting a matrix an

Re: [R] subsetting a matrix and filling other

2006-11-07 Thread antonio rodriguez
prompt again. I think I have enough memory (512) and a pretty good processor (P4, 2.8) Antonio > -Christos > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of antonio rodriguez > Sent: Tuesday, November 07, 2006 2:01 PM > To: R-H

Re: [R] subsetting a matrix and filling other

2006-11-07 Thread Christos Hatzis
: R-Help Subject: [R] subsetting a matrix and filling other Hi, Having a matrix F(189,6575) I want to do this: z1<-subset(F[,1], F[,1] >= 5 & F[,1] <= 10) . . . z189<-subset(F[,189], F[,189] >= 5 & F[,189] <= 10) I would prefer to have an empty matrix, say 'z&#

[R] subsetting a matrix and filling other

2006-11-07 Thread antonio rodriguez
Hi, Having a matrix F(189,6575) I want to do this: z1<-subset(F[,1], F[,1] >= 5 & F[,1] <= 10) . . . z189<-subset(F[,189], F[,189] >= 5 & F[,189] <= 10) I would prefer to have an empty matrix, say 'z' in order to fill its columns with the output of subsetting F. But each of the subsets can dif

Re: [R] Subsetting a matrix without for-loop

2006-01-30 Thread Petr Pikal
006 at 16:29, Camarda, Carlo Giovanni wrote: Date sent: Mon, 30 Jan 2006 16:29:38 +0100 From: "Camarda, Carlo Giovanni" <[EMAIL PROTECTED]> To: Subject: [R] Subsetting a matrix without for-loop > Dear R-users, &g

Re: [R] Subsetting a matrix without for-loop

2006-01-30 Thread jim holtman
use 'filter': > x <- matrix(1:100,10) > x [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]1 11 21 31 41 51 61 71 8191 [2,]2 12 22 32 42 52 62 72 8292 [3,]3 13 23 33 43 53 63 73 8393 [4,]4 14 24 34 4

Re: [R] Subsetting a matrix without for-loop

2006-01-30 Thread Gabor Grothendieck
The result is linear in A so its a matter of finding the matrix to multiply it by: matrix(c(rep(1,3), rep(0,7)), 3, 9, byrow = TRUE) %*% A On 1/30/06, Camarda, Carlo Giovanni <[EMAIL PROTECTED]> wrote: > Dear R-users, > I'm struggling in R in order to "squeeze" a matrix without using a > for-loo

[R] Subsetting a matrix without for-loop

2006-01-30 Thread Camarda, Carlo Giovanni
Dear R-users, I'm struggling in R in order to "squeeze" a matrix without using a for-loop. Although my case is a bit more complex, the following example should help you to understand what I would like to do, but without the slow for-loop. Thanks in advance, Carlo Giovanni Camarda A <- matrix(1:5

Re: [R] subsetting a matrix

2003-09-30 Thread Rajarshi Guha
On Tue, 2003-09-30 at 15:51, Jason Turner wrote: > (Ted Harding) wrote: > > > On 30-Sep-03 Rajarshi Guha wrote: > > > >>Hi, > >> I'm trying to take a set of rows and columns out of a matrix. I hve > >>been using the index aray approach. My overll matrix is X and is 179 x > >>65. I want to take o

Re: [R] subsetting a matrix

2003-09-30 Thread Jason Turner
(Ted Harding) wrote: On 30-Sep-03 Rajarshi Guha wrote: Hi, I'm trying to take a set of rows and columns out of a matrix. I hve been using the index aray approach. My overll matrix is X and is 179 x 65. I want to take out 4 columns and 161 rows. ... This is documented in "An Introduction to R", u

RE: [R] subsetting a matrix

2003-09-30 Thread Ted Harding
On 30-Sep-03 Rajarshi Guha wrote: > Hi, > I'm trying to take a set of rows and columns out of a matrix. I hve > been using the index aray approach. My overll matrix is X and is 179 x > 65. I want to take out 4 columns and 161 rows. > > Thus I made a 161 x 2 array I and filled it up with the row,

Re: [R] subsetting a matrix

2003-09-30 Thread Thomas W Blackwell
Rajarshi - Why not simply subscript your matrix X to return the rows and columns you want to keep ? For example, new <- X[16:176, c(3,5,7,9)] assuming those are the rows and columns you want. See help("Extract"). - tom blackwell - u michigan medical school - ann arbor - On Tue, 30 Sep

[R] subsetting a matrix

2003-09-30 Thread Rajarshi Guha
Hi, I'm trying to take a set of rows and columns out of a matrix. I hve been using the index aray approach. My overll matrix is X and is 179 x 65. I want to take out 4 columns and 161 rows. Thus I made a 161 x 2 array I and filled it up with the row,col indices. However doing, X[ I ] gives me a

Re: [R] Subsetting a matrix [Again!]

2003-07-15 Thread Ted Harding
On 15-Jul-03 Achim Zeileis wrote: >> >[...] >> > mu1<-mu[iX1,drop=FALSE]; mu2<-mu[iX2,drop=FALSE]; >> > mu1 >> >> [1] 1 >> >> > mu2 >> >> [1] 2 3 >> >> So now I still don't get my 1xk matrices, even though mu is a >> matrix and I've used "drop=FALSE". Why? > > Because you are subsetting mu like a

Re: [R] Subsetting a matrix [Again!]

2003-07-15 Thread Achim Zeileis
On Tuesday 15 July 2003 12:14, Ted Harding wrote: > Hi Folks, > > People's suggestion of "drop=FALSE" seemed to do the trick > (preserving "matrix" character when subestting to a row, > i.e. creating 1xk matrix). > > However, I seem to have encountered a case where even this does > > not work: > >

[R] Subsetting a matrix [Again!]

2003-07-15 Thread Ted Harding
Hi Folks, People's suggestion of "drop=FALSE" seemed to do the trick (preserving "matrix" character when subestting to a row, i.e. creating 1xk matrix). However, I seem to have encountered a case where even this does not work: > mu<-c(1,2,3) > mu<-matrix(mu,nrow=1) > mu [,1] [,2] [,3]

Re: [R] Subsetting a matrix

2003-07-14 Thread Ted Harding
On 14-Jul-03 Adelchi Azzalini wrote: >> Maybe it is reasonable to propose incorporating "drop" as one of the >> things you can set with "options"? :-- >> [...] > > Perhaps this is a way-out. As usual, everything is feasible when we > resort entirely on our own code. The danger is that we might ma

Re: [R] Subsetting a matrix

2003-07-14 Thread Adelchi Azzalini
> Maybe it is reasonable to propose incorporating "drop" as one of the > things you can set with "options"? :-- > > `options' allows the user to set and examine a variety of global > ``options'' which affect the way in which R computes and displays > its results. > Perhaps this is

Re: [R] Subsetting a matrix

2003-07-14 Thread Ted Harding
On 14-Jul-03 Adelchi Azzalini wrote: > Personally, I find this automatic conversion to "vector" a somewhat > confusing feature (although I can see its reasons), and I know of > many people that would have preferred that drop=FALSE was the > default behaviour, but surely now is difficult to cha

Re: [R] Subsetting a matrix

2003-07-14 Thread Adelchi Azzalini
On Monday 14 July 2003 11:59, you wrote: > I'd welcome some comments or advice regarding the situation described > below. > > The following illustrates what seems to me to be an inconsistency > in the behaviour of matrix subsetting: > >   > Z<-matrix(c(1.1,2.1,3.1,1.2,2.2,3.2,1.3,2.3,3.3),nrow=3) >

[R] Subsetting a matrix

2003-07-14 Thread Ted Harding
I'd welcome some comments or advice regarding the situation described below. The following illustrates what seems to me to be an inconsistency in the behaviour of matrix subsetting: > Z<-matrix(c(1.1,2.1,3.1,1.2,2.2,3.2,1.3,2.3,3.3),nrow=3) > Z [,1] [,2] [,3] [1,] 1.1 1.2 1.3 [2