[R] Bug in sd() and var() in handling vectors of NA (R version 2.7.1)?

From: Marisa Laetitia <MarisaL_at_ligue-cancer.net>
Date: Tue, 29 Jul 2008 11:51:17 +0200


In the previous versions of R (2.6.1), when a vector of NA was given to the functions 'sd' or 'var' with parameter na.rm = TRUE, it used to return NA. Now (2.7.1) it returns an ERROR :  

Example in 2.6.1:

> sd(c(NA, NA, NA, NA), na.rm = TRUE)

[1] NA  

Example in 2.7.1:

> sd(c(NA, NA, NA, NA), na.rm = TRUE)

Error in var(x, na.rm = na.rm) : paires d'éléments incomplètes  

We are actually wondering if it is a bug to report, or if we have to manage it in our own R scripts.  

Thanks a lot, best regards,  

Laetitia  



This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 29 Jul 2008 - 10:18:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Jul 2008 - 13:32:46 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive