[R] Counting NA?

Petr Pikal petr.pikal at precheza.cz
Thu Oct 24 07:55:33 CEST 2002



On 23 Oct 2002 at 10:52, Matej Cepl wrote:

> On Wed, Oct 23, 2002 at 01:54:50PM +0200, David Wartel wrote:
> > Surely not the best method:
> > length(which(is.na(data$S2)==TRUE))
> 
> Hi,
> 
> I am sorry, of course, that I have found similar solution
> ("==TRUE" is unnecessary) five seconds after firing up
> 'sendmail -q'.  Thanks for the references to z-score,
> t-distribution, etc., though.
> 
> One this I was really surprised what that in order to get data
> from the same data I have to use following construct constantly:
> 
>  sumyes <- length(data$S2[data$S2 == 1 & !is.na(data$S2)])
> 
> Isn't there any way how to say R, that I want eliminate NA data 
> for all my following calculations?

?na.rm
?na.omit
?na.exclude

depending what you want to do with the result.



> 
> Matej
> 
> -- 
> Matej Cepl, matej at ceplovi.cz, PGP ID# D96484AC
> 138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
> 
> The politician attempts to remedy the evil by increasing the very
> thing that caused the evil in the first place: legal plunder.
>     -- Frederick Bastiat
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -.-.-.-.- r-help mailing list -- Read
> http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help",
> or "[un]subscribe" (in the "body", not the subject !)  To:
> r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _._._._._

Petr Pikal
petr.pikal at precheza.cz
p.pik at volny.cz


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list