Dear Jorge
Thanks a lot.



----- Original Message ----
From: Jorge Ivan Velez <jorgeivanvelez@gmail.com>
To: Muhammad Azam <mazam72@yahoo.com>
Cc: R mailing list <r-help@r-project.org>
Sent: Tuesday, October 14, 2008 1:52:15 PM
Subject: Re: [R] request: How to ignore columns having zero sums



Dear Muhammad,

Try also

x <- c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,0,0,0,0,0,0,0,0);
x1 <- array(x, dim=c(4,6))
x1[,apply(x1,2,function(x) !all(x==0))]

HTH,

Jorge


On Tue, Oct 14, 2008 at 4:02 AM, Muhammad Azam <mazam72@yahoo.com> wrote:

Dear friends
I have an array consist of r-rows and c-columns e.g.
x=c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,0,0,0,0,0,0,0,0);
x1=array(x, dim=c(4,6))
output is
> x1
    [,1] [,2] [,3] [,4] [,5] [,6]
[1,]    1    2    3    4    0    0
[2,]    1    2    3    4    0    0
[3,]    1    2    3    4    0    0
[4,]    1    2    3    4    0    0
How can i ignore columns having zero sums? Help in this regard is needed. Thanks


M.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]]

