On 06/10/15 20:24, Neverstop wrote:
Hi all.
I don't understand why R works this way:
rm(list=ls())
require(foreign)
dataset <- read.dta("http://www.ats.ucla.edu/stat/data/ologit.dta")
min(dataset$gpa)
[1] 1.9
min(dataset$gpa)>=1.90
[1] FALSE
min(dataset$gpa)>=1.9
[1] FALSE
min(dataset$gpa)>1.89
[1] TRUE
Shouldn't I get 3 TRUEs?
No.
Am I missing something?
Comprehension of significant digits and the storage of floating point
numbers.
Try:
print(min(dataset$gpa),digits=10)
Please don't refer to phenomena as "bugs" unless you are really sure
that they are not simply instances of things that you don't understand.
R was designed and written by very clever people and has been used,
tested and pushed to its limits by a wide variety of users for over 20
years. It is highly improbable that you would stumble upon a real bug
in such a simple context.
cheers,
Rolf Turner
--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.