[R] length with missing values
Dimitris Rizopoulos
dimitris.rizopoulos at med.kuleuven.ac.be
Fri Oct 15 13:50:26 CEST 2004
or even:
colSums(!is.na(mat))
Best,
Dimitris
----- Original Message -----
From: "Peter Dalgaard" <p.dalgaard at biostat.ku.dk>
To: "Dimitris Rizopoulos" <dimitris.rizopoulos at med.kuleuven.ac.be>
Cc: ""Luis Rideau Cruz"" <Luisr at frs.fo>; <r-help at stat.math.ethz.ch>
Sent: Friday, October 15, 2004 1:43 PM
Subject: Re: [R] length with missing values
> "Dimitris Rizopoulos" <dimitris.rizopoulos at med.kuleuven.ac.be>
> writes:
>
>> Hi Luis,
>>
>> just use:
>>
>> apply( mat, 2, function(x) length(x[!is.na(x)]) )
>
>
> or:
>
> apply(!is.na(mat),2,sum)
>
> --
> O__ ---- Peter Dalgaard Blegdamsvej 3
> c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
> (*) \(*) -- University of Copenhagen Denmark Ph: (+45)
> 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45)
> 35327907
>
More information about the R-help
mailing list