Dimitris Rizopoulos wrote:
On 3/9/2010 1:36 PM, Paul Hiemstra wrote:
Dimitris Rizopoulos wrote:
one approach is the following:
mat <- matrix(rnorm(100*45), 100, 45)
mat[sample(100*45, 50)] <- 0
index <- rowMeans(mat == 0) == 0
mat[index, ]
Dimitris,
You use quite a complicated syntax to g
Dimitris Rizopoulos wrote:
one approach is the following:
mat <- matrix(rnorm(100*45), 100, 45)
mat[sample(100*45, 50)] <- 0
index <- rowMeans(mat == 0) == 0
mat[index, ]
Dimitris,
You use quite a complicated syntax to get the index. I think the
following syntax using apply is more easy to u
On 3/9/2010 1:36 PM, Paul Hiemstra wrote:
Dimitris Rizopoulos wrote:
one approach is the following:
mat <- matrix(rnorm(100*45), 100, 45)
mat[sample(100*45, 50)] <- 0
index <- rowMeans(mat == 0) == 0
mat[index, ]
Dimitris,
You use quite a complicated syntax to get the index. I think the
fo
one approach is the following:
mat <- matrix(rnorm(100*45), 100, 45)
mat[sample(100*45, 50)] <- 0
index <- rowMeans(mat == 0) == 0
mat[index, ]
I hope it helps.
Best,
Dimitris
On 3/9/2010 11:05 AM, ogbos okike wrote:
Hi Everybody,
I have a matrix of about 45 columns. Some of the rows conta
Hi Everybody,
I have a matrix of about 45 columns. Some of the rows contain zeros. Using
>data1<-data[complete.cases(data),], I can remove the "NA" rows. But I am
unable to tackle that of zeros.
Can anybody give me an idea of how to remove rows containing zeros in a
matrix.
Thanks so much
Best
Ogbo
5 matches
Mail list logo