[R] sample() issue

Viechtbauer Wolfgang (STAT) wolfgang.viechtbauer at maastrichtuniversity.nl
Mon Dec 20 20:37:57 CET 2010


See FAQ 7.31: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f

And try this:

25000*(1-.55) - 11250

25000*.45 - 11250

Notice a difference?

Best,

--
Wolfgang Viechtbauer
Department of Psychiatry and Neuropsychology
School for Mental Health and Neuroscience
Maastricht University, P.O. Box 616
6200 MD Maastricht, The Netherlands
Tel: +31 (43) 368-5248
Fax: +31 (43) 368-8689
Web: http://www.wvbauer.com


----Original Message----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of cory n Sent: Monday, December 20, 2010 20:04
To: r-help at r-project.org
Subject: [R] sample() issue

>> length(sample(25000, 25000*(1-.55)))
> [1] 11249
>
>> 25000*(1-.55)
> [1] 11250
>
>> length(sample(25000, 11250))
> [1] 11250
>
>> length(sample(25000, 25000*.45))
> [1] 11250
>
> So the question is, why do I get 11249 out of the first command and not
> 11250?  I can't figure this one out.
>
> Thanks
>
> Cory
>
>       [[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.



More information about the R-help mailing list