[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
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
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?
>>
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
[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
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
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,
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
8 matches
Mail list logo