Hi

Could you use something along the lines of the following:

transposedat<-t(dat)
transposedat$oddrow<-(1:ncol(dat))%%2

oddcolumns<-t(transposedat[transposedat$oddrow==1,])

Now you should have the odd columns in a single dataframe.

gzero<-matrix(oddcolumns>0,nrow=nrow(oddcolumns),ncol=ncol(oddcolumns))
colSums(gzero)

Best regards
Per Jensen

On 6/20/06, markleeds@verizon.net <markleeds@verizon.net> wrote:
>
> I've tried and give up. I have a matrix of say 200 columns and 400 rows.
>
> For each odd ( or even i suppose if i wanted to )column,
> I want to know the number of rows in which the value is greater than zero.
>
> So, I did sapply(tempMatrix,2,function(x) sum( x > 0 ))
>
> this almost works but i don't know how to tell
> it to only do the odd columns. my guess is , like everything else
> in R, this is possible. Thanks.
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

	[[alternative HTML version deleted]]

