[R] deleting collumns with colSums==0

2007-04-26 Thread Milton Cezar Ribeiro
Dear all, I have some matrices which colSums are equal to zero and I would like to delete all them. How can I do that? Kind regards, miltinho Brazil __ [[alternative HTML version deleted]]

Re: [R] deleting collumns with colSums==0

2007-04-26 Thread Giovanni Petris
A - A[, colSums(A) != 0] (untested) Date: Thu, 26 Apr 2007 05:19:21 -0700 (PDT) From: Milton Cezar Ribeiro [EMAIL PROTECTED] Sender: [EMAIL PROTECTED] Precedence: list Dear all, I have some matrices which colSums are equal to zero and I would like to delete all them. How can I do

Re: [R] deleting collumns with colSums==0

2007-04-26 Thread jim holtman
I assume that you mean you want the columns deleted. If so, this might work: set.seed(1) x - matrix(sample(0:1,100,replace=TRUE,prob=c(.9,.1)), ncol=10) x [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]001000100 0 [2,]000