[R] length with missing values

Luis Rideau Cruz Luisr at frs.fo
Fri Oct 15 13:01:25 CEST 2004


R-help

I have a martix with missing values( in which I want the sample size by
column)
When I :

apply(matrix,2,length)

I get the length of the vector regardless of missing values.
I can't pass an argument to length in apply.

Alternatively I could 

ifelse ( is.na ( matrix [, "columns in matrix " ] ) , 0 , 1)

Is there any easier way?

Thank you




More information about the R-help mailing list