Re: [R] request: How to get column name

2008-09-03 Thread Petr PIKAL
[EMAIL PROTECTED] napsal dne 03.09.2008 17:34:24: > On 9/3/2008 11:05 AM, Petr PIKAL wrote: > > [EMAIL PROTECTED] napsal dne 03.09.2008 15:54:08: > > > >> try this: > >> > >> x <- c(3,3,3,3,0,0,0,0,5,5,5,5,8,8,8,8) > >> x <- matrix(x, nrow=4) > >> > >> which(colSums(x == 0) == nrow(x)) > > > > I

Re: [R] request: How to get column name

2008-09-03 Thread Henrique Dallazuanna
Or: which(apply(x == 0, 2, all)) On Wed, Sep 3, 2008 at 12:46 PM, Marc Schwartz <[EMAIL PROTECTED]>wrote: > on 09/03/2008 10:34 AM Chuck Cleland wrote: > > On 9/3/2008 11:05 AM, Petr PIKAL wrote: > >> [EMAIL PROTECTED] napsal dne 03.09.2008 15:54:08: > >> > >>> try this: > >>> > >>> x <- c(3,3,3

Re: [R] request: How to get column name

2008-09-03 Thread Marc Schwartz
on 09/03/2008 10:34 AM Chuck Cleland wrote: > On 9/3/2008 11:05 AM, Petr PIKAL wrote: >> [EMAIL PROTECTED] napsal dne 03.09.2008 15:54:08: >> >>> try this: >>> >>> x <- c(3,3,3,3,0,0,0,0,5,5,5,5,8,8,8,8) >>> x <- matrix(x, nrow=4) >>> >>> which(colSums(x == 0) == nrow(x)) >> Isn't this the same? >>

Re: [R] request: How to get column name

2008-09-03 Thread Chuck Cleland
On 9/3/2008 11:05 AM, Petr PIKAL wrote: > [EMAIL PROTECTED] napsal dne 03.09.2008 15:54:08: > >> try this: >> >> x <- c(3,3,3,3,0,0,0,0,5,5,5,5,8,8,8,8) >> x <- matrix(x, nrow=4) >> >> which(colSums(x == 0) == nrow(x)) > > Isn't this the same? > > which(colSums(x)==0) No, because the column s

Re: [R] request: How to get column name

2008-09-03 Thread Petr PIKAL
[EMAIL PROTECTED] napsal dne 03.09.2008 15:54:08: > try this: > > x <- c(3,3,3,3,0,0,0,0,5,5,5,5,8,8,8,8) > x <- matrix(x, nrow=4) > > which(colSums(x == 0) == nrow(x)) Isn't this the same? which(colSums(x)==0) Regards Petr > > I hope it helps. > > Best, > Dimitris > > > Muhammad Azam wr

Re: [R] request: How to get column name

2008-09-03 Thread Jorge Ivan Velez
Dear Muhammad, Try also: x=c(3,3,3,3,0,0,0,0,5,5,5,5,8,8,8,8) x=matrix(x, nrow=4) which(colSums(x)==0) [1] 2 HTH, Jorge On Wed, Sep 3, 2008 at 9:45 AM, Muhammad Azam <[EMAIL PROTECTED]> wrote: > Dear R community > I have a problem regarding which of the column in a matrix contains all of > z

Re: [R] request: How to get column name

2008-09-03 Thread Dimitris Rizopoulos
try this: x <- c(3,3,3,3,0,0,0,0,5,5,5,5,8,8,8,8) x <- matrix(x, nrow=4) which(colSums(x == 0) == nrow(x)) I hope it helps. Best, Dimitris Muhammad Azam wrote: Dear R community I have a problem regarding which of the column in a matrix contains all of zero elements. e.g. x=c(3,3,3,3,0,0,0,

[R] request: How to get column name

2008-09-03 Thread Muhammad Azam
Dear R community I have a problem regarding which of the column in a matrix contains all of zero elements. e.g. x=c(3,3,3,3,0,0,0,0,5,5,5,5,8,8,8,8); x=matrix(x, nrow=4) the output is > x [,1] [,2] [,3] [,4] [1,]3058 [2,]3058 [3,]3058 [4,]3