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
> 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,]    3    0    5    8
> [2,]    3    0    5    8
> [3,]    3    0    5    8
> [4,]    3    0    5    8
> In this case the required column is second so the result should be "2". How
> can i get it?
>
>
> best regards
>
> Muhammad Azam
>
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to