[R] odd behavior of numeric()
jdnewmil at dcn.davis.ca.us
Thu Apr 28 06:11:50 CEST 2016
0.2 is slightly larger than 1/5, and 1-0.8 is slightly smaller. The argument to numeric has to be an integer, so fractions are discarded. This behavior is not unique to R.
Sent from my phone. Please excuse my brevity.
On April 27, 2016 8:29:13 PM GMT+01:00, Scott Rifkin <sarifkin at ucsd.edu> wrote:
> > numeric(0.2*25)
> 0 0 0 0 0
> > numeric((1-0.8)*25)
> 0 0 0 0
>[running version 3.2.0]
>[Apologies if this has been asked before - it's a hard question to find
>specific search terms for]
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help