Re: [R] removing missing values from a matrix

2009-10-02 Thread Amit Kumar
Thanks! It worked! There is another problem I want to subset the matrix 'red' in following manner: dim(red) 23688 164 a=red[1:23688,1:4] b=red[1:23688,5:8] c=red[1:23688,9:12] .. .. z=red[1:23688,161:164] If there any efficient way to do

Re: [R] removing missing values from a matrix

2009-10-02 Thread jim holtman
Here is one way to do it. BTW 'a'-'z' won't work because there are 41 splits. Use a list instead: red - matrix(seq(23688 * 164), nrow=23688, ncol=164) # create indices indx - split(1:164, cut(1:164, 41)) # now split matrix newMatrix - lapply(indx, function(x) red[, x]) str(newMatrix)

Re: [R] removing missing values from a matrix

2009-10-02 Thread Amit Kumar
Thanks! Jim It solved my problem. Best Amit On Fri, Oct 2, 2009 at 11:19 AM, jim holtman jholt...@gmail.com wrote: Here is one way to do it.  BTW 'a'-'z' won't work because there are 41 splits.  Use a list instead: red - matrix(seq(23688 * 164), nrow=23688, ncol=164) # create indices indx

[R] removing missing values from a matrix

2009-10-01 Thread Amit Kumar
Hi! All, I am working with a large matrix of dimension 23689 x 162. Some of the values of this matrix is missing (NA). And it looks something like that: dim(red) 23689 162 red [,1] [,2] [,3] [,4] [,5] [1,]2 NA4 9 6 [2,]5 NA6 NA 1 [3,] NA

Re: [R] removing missing values from a matrix

2009-10-01 Thread Carvalho, Benilton
red[is.na(red)] - 0 Sent from my iPhone On Oct 1, 2009, at 7:22 PM, Amit Kumar amitkumartiw...@gmail.com wrote: Hi! All, I am working with a large matrix of dimension 23689 x 162. Some of the values of this matrix is missing (NA). And it looks something like that: dim(red) 23689 162

Re: [R] removing missing values from a matrix

2009-10-01 Thread Bert Gunter
01, 2009 3:34 PM To: Amit Kumar Cc: r-help@r-project.org Subject: Re: [R] removing missing values from a matrix red[is.na(red)] - 0 Sent from my iPhone On Oct 1, 2009, at 7:22 PM, Amit Kumar amitkumartiw...@gmail.com wrote: Hi! All, I am working with a large matrix of dimension 23689 x 162

Re: [R] removing missing values from a matrix

2009-10-01 Thread Rolf Turner
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Carvalho, Benilton Sent: Thursday, October 01, 2009 3:34 PM To: Amit Kumar Cc: r-help@r-project.org Subject: Re: [R] removing missing values from a matrix red[is.na(red)] - 0 Sent from

Re: [R] removing missing values from a matrix

2009-10-01 Thread Carvalho, Benilton
, Benilton Sent: Thursday, October 01, 2009 3:34 PM To: Amit Kumar Cc: r-help@r-project.org Subject: Re: [R] removing missing values from a matrix red[is.na(red)] - 0 Sent from my iPhone On Oct 1, 2009, at 7:22 PM, Amit Kumar amitkumartiw...@gmail.com wrote: Hi! All, I am working

Re: [R] removing missing values from a matrix

2009-10-01 Thread Rolf Turner
On 2/10/2009, at 1:03 PM, Carvalho, Benilton wrote: I agree with you folks, my assumption is that the user knows what he's doing. Almost surely a rash assumption! (I.e. except for a set of users of probability zero.) :-) cheers, Rolf