Re: [R] Delete rows from matrix having at least one zero value

2008-11-09 Thread stephen sefick
# I think this does what you want d <- rbind(c(1,0,6,4), c(2,5, 7,5), c(3,6,8,6), c(4,0,0,0)) f <- as.matrix(d) f[-which(rowSums(f==0)>0),] On Sun, Nov 9, 2008 at 8:30 AM, mentor_ <[EMAIL PROTECTED]> wrote: > > Have found a solution: > > matrix[rowSums

Re: [R] Delete rows from matrix having at least one zero value

2008-11-09 Thread Jorge Ivan Velez
Dear mentor_, Try also yourmat <- matrix(c( 1,0,6,4, 2,5, 7,5, 3,6,8,6, 4,0,0,0 ),ncol=4,byrow=TRUE) yourmat[apply(yourmat,1,function(x) sum(x==0)<1),] HTH, Jorge On Sun, Nov 9, 2008 at 7:39 AM, mentor_ <[EMAIL PROTECTED]> wrote: > > Hi, > > I h

Re: [R] Delete rows from matrix having at least one zero value

2008-11-09 Thread stephen sefick
# I think this does what you want d <- rbind(c(1,0,6,4), c(2,5, 7,5), c(3,6,8,6), c(4,0,0,0)) f <- as.matrix(d) f[-which(rowSums(f==0)>0),] On Sun, Nov 9, 2008 at 8:30 AM, mentor_ <[EMAIL PROTECTED]> wrote: > > Have found a solution: > > matrix[rowSums

[R] Delete rows from matrix having at least one zero value

2008-11-09 Thread mentor_
Hi, I have a further question about matrix manipulation. Imagine the following two matrices: > test [,1] [,2] [,3] [,4] [1,]1064 [2,]2575 [3,]3686 [4,]4000 > matrix(is.element(test,0), ncol=4) [,1] [,2] [,3] [,4] [1,]

Re: [R] Delete rows from matrix having at least one zero value

2008-11-09 Thread mentor_
Have found a solution: matrix[rowSums(matrix == 0) == 0, ] mentor_ wrote: > > Hi, > > I have a further question about matrix manipulation. > > Imagine the following two matrices: >> test > [,1] [,2] [,3] [,4] > [1,]1064 > [2,]2575 > [3,]368