[R] Counting NA?

David Wartel dwartel at ulb.ac.be
Wed Oct 23 13:54:50 CEST 2002


Surely not the best method:
length(which(is.na(data$S2)==TRUE))


On Wednesday 23 October 2002 08:48, Matej Cepl wrote:
> Hi,
>
> how to do quickly equivalent of the following?
>
> 	counter = 0
> 	for(i in 1:length(data$S2)) {
> 		if(!is.na(data$S2[i])) {
> 			counter = counter + 1
> 		}
> 	}
>
> I have imagined something like length(x,na.rm=TRUE).
>
> How can I get values usually taken from tables like z-score,
> values of t distribution etc.? I could not find them among
> values mentioned in info file.
>
> Thanks,
>
> Matej

-- 
David Wartel

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