[R] seq() question
joris.dewolf at cropdesign.com
joris.dewolf at cropdesign.com
Sat Sep 29 14:03:29 CEST 2007
Has something do with the precision. Check this:
all.equal(1.1, brks[4], tolerance = 0)
all.equal(1.2, brks[5], tolerance = 0)
all.equal(1.2, brks[5])
"Derek Ogle"
<DOgle at northland.
edu> To
Sent by: <R-help at r-project.org>
r-help-bounces at r- cc
project.org
Subject
[R] seq() question
29/09/2007 04:58
Hello all,
I am attempting to use the seq() function to define breaks for the cut()
function but am finding performance that I do not understand. The root of
my problem appears to be contained in the following simple example.
> brks <- seq(0.8,1.2,0.1)
> brks
[1] 0.8 0.9 1.0 1.1 1.2
> brks==1.2
[1] FALSE FALSE FALSE FALSE FALSE
> brks==1.1
[1] FALSE FALSE FALSE TRUE FALSE
The last value in the sequence does not appear to be equal to its apparent
value (i.e., 1.2) whereas the fourth value in the sequence, for example,
does (e.g., 1.1).
Any help/suggestions with the concept or "trick" that I am missing here?
Thank you in advance.
p.s., I am using R 2.5.1 with ...
> Sys.info()
sysname release
"Windows" "NT 5.1"
version nodename
"(build 2600) Service Pack 2" "CSE229-001"
machine
"x86"
______________________________________________
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