R 3.5.1 on Windows 7

The documentation for 'var' says:  "These functions return 'NA' when there is 
only one observation (whereas S-PLUS has been  returning 'NaN'), and fail if 
'x' has length zero."  The function 'sd' (based on 'var') has similar 
documentation.

However, I get:
var(numeric(0))
[1] NA

rather than an error.

Personally I prefer that basic summary functions like 'var' not throw errors 
even in corner cases.   But either way, the result and the docs are 
inconsistent.

Richard Raubertas

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1   
>



Notice:  This e-mail message, together with any attachme...{{dropped:13}}

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to