try this:

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))

ind <- colSums(x1) != 0
x1[, ind]


I hope it helps.

Best,
Dimitris


Muhammad Azam 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.


--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014

______________________________________________
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