similar to: cut with floating point, a bug?

Displaying 20 results from an estimated 7000 matches similar to: "cut with floating point, a bug?"

2009 Sep 13
2
How can I get "predict.lm" results with manual calculations ? (a floating point problem)
Hello dear r-help group I am turning for you for help with FAQ number 7.31: "Why doesn't R think these numbers are equal?" http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f *My story* is this: I wish to run many lm predictions and need to have them run fast. Using predict.lm is relatively slow, so I tried having it run faster by
2017 Jun 07
0
An R question
Hi, Check the FAQ 7.31 https://cran.rstudio.com/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f And read the posting guide too... https://www.r-project.org/posting-guide.html HTH, Ivan -- Dr. Ivan Calandra TraCEr, Laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567
2005 Nov 01
5
Unexpected result from binary greater than operator
Hi All, I recently encountered results that I did not expect, exhibited by the following code snippet: test <- function() { minX <- 4.2 min0 <- 4.1 sigmaG <- 0.1 Diff <- minX-min0 print(c(Diff=Diff,sigmaG=sigmaG)) cat("is Diff > sigmaG?:", Diff > sigmaG,"\n") cat("is (4.2 - 4.1) > 0.1?:",(4.2 - 4.1) >
2023 Jan 07
1
gmp::bigq vs. MASS::fractions
On Sat, 7 Jan 2023 17:29:35 +0100 Sigbert Klinke <sigbert at wiwi.hu-berlin.de> wrote: > > x <- (0:7)/7 > > > MASS::fractions(x) > > [1] 0 1/7 2/7 3/7 4/7 5/7 6/7 1 > > > gmp::as.bigq(x) > > Big Rational ('bigq') object of length 8: > > [1] 0 > 2573485501354569/18014398509481984 2573485501354569/9007199254740992 >
2013 Apr 24
1
Floating point precision causing undesireable behaviour when printing as.POSIXlt times with microseconds?
Dear list, When using as.POSIXlt with times measured down to microseconds the default format.POSIXlt seems to cause some possibly undesirable behaviour: According to the code in format.POSIXlt the maximum accuracy of printing fractional seconds is 1 microsecond, but if I do; options( digits.secs = 6 ) as.POSIXlt( 1.000002 , tz="", origin="1970-01-01") as.POSIXlt( 1.999998 ,
2009 Apr 07
3
strange (?) behavoir of expand.grid()
Hello, I came across a strange behavior of expand.grid (or at least strange to me). For certain values of one of my input variables - created by seq() - I have to use strings (e.g ==".6") to select a row of the object created by expand.grid(), for other values numerical (e.g. ==.8) and for some both work. Please find an example below. #Example x<- seq(0,1,1/10) y <-
2008 Oct 03
2
Question about quantile.default
Hi all, I am running into a snag using quantile function in stats. Basically, I don't understand why the loop below throws the error that it does. test.data <- rnorm(1000, 0, 1) for (i in seq(0.00001, 0.001, 0.00001)){ test <- quantile(test.data, probs=seq(0,1,i)); print(i); } It runs fine from 1e-05 to 0.00024, but then throws the error Error in quantile.default(test.data,
2012 Jul 10
1
identify.hclust() doesn't cut tree at the vertical position of the mouse pointer
Dear All According to the identify.hclust documentation the function "cuts the tree at the vertical position of the pointer and highlights the cluster containing the horizontal position of the pointer". When I carry out this, the tree isn't cut where I click - in fact, there seems to be a limit below which I cannot go. Consider the following code: mat <- matrix(rnorm(5000),
2009 Oct 15
2
forwarded: bug (?) in cut.POSIXt with "breaks"=integer
From: Vitalie S. <vitosmail <at> rambler.ru> Subject: Bug in cut.POSIXt Newsgroups: gmane.comp.lang.r.general Date: 2009-10-15 15:47:48 GMT (1 hour and 29 minutes ago) Hello Everyone, Before reporting decided to post here first: tt <- structure(c(1254238817, 1254238859, 1254238969, 1254239080), class = c("POSIXt",
2006 Dec 09
2
Floating point maths in R
Hi, I am not sure if this is just me using R (R-2.3.1 and R-2.4.0) in the wrong way or if there is a more serious bug. I was having problems getting some calculations to add up so I ran the following tests: > (2.34567 - 2.00000) == 0.34567 <------- should be true [1] FALSE > (2.23-2.00) == 0.23 <------- should be true [1] FALSE > 4-2==2 [1] TRUE > (4-2)==2 [1] TRUE >
2010 Feb 02
1
"strange" behaviour: recognition of decimal numbers by 'which'
It is a strange behaviour in that I did not expect it... but I am sure there is a simple explanation for it and it'll have to do with the way numbers are stored in R, but it's caught me by surprise and I don't find it obvious. Here's a simplified example reproducing the behaviour I encountered: I create an empty vector, and I fill it with a sequence of numbers: 0, 0.005,
2013 Apr 30
3
Subset of a 'table' divided by a 'table' is a 'table', but printed by 'print.default'
This is just info. I recently got something like this. > x <- factor(c("A","A","B","B"), levels=c("A","B")) > y <- factor(c("a","b","a","b"), levels=c("a","b")) > table(x, y)[, "a"] / table(x) x A B 0.5 0.5 attr(,"class") [1]
2011 Mar 30
2
problem with png() and large dimensions on some 32-bit Windows machines
Hello, I encountered this: > png(file=tempfile(), width=1165, height=12983) Error in png(file = tempfile(), width = 1165, height = 12983) : unable to start png() device In addition: Warning messages: 1: In png(file = tempfile(), width = 1165, height = 12983) : Unable to allocate bitmap 2: In png(file = tempfile(), width = 1165, height = 12983) : opening device failed > On the
2011 Aug 09
1
embedFonts() does not embed fonts?
Dear helpers, I'm trying out the embedFonts() to embed fonts into my pdf files. However, when I inspect the new pdf with a program designed to look for embedded fonts, I see that the fonts have in fact not been embedded. Below are my calls. R version 2.13.1 (2011-07-08) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i386-pc-mingw32/i386 (32-bit)
2013 Feb 04
4
rJava works with 32-bit but not 64
Hello: rJava works for me under 32-bit but under not 64-bit R; see below. Suggestions? Thanks, Spencer > library(rJava) Error : .onLoad failed in loadNamespace() for 'rJava', details: call: stop("No CurrentVersion entry in '", key, "'! Try re-installing Java and make sure R and Java have matching architectures.")
2008 Feb 25
1
RWinEdt Install issue
Dear RUsers, I just upgraded from 2.6.0 to 2.6.2 and tried to reinstall the RWinEdt patch to work with WinEdt so that I can continue function as I always have but I have run into problems that I don't understand how to fix. Any help would be great. Essentially, I downloaded the latest RWinEdt zip folder from the CRAN website and tried calling the library. I tried re-installing it a bunch of
2011 Nov 24
1
capture.output(eval(..., envir)) not evaluate in the expected(?) environment
I've noticed the following oddity where capture.output() prevents eval() from evaluating an expression in the specified environment. I'm not sure if it is an undocumented feature or a bug. It caused me many hours of troubleshooting. By posting it here, it might save someone else from doing the same exercise. Start by defining foo() which evaluates an expression locally in a given
2010 Jun 09
1
bug? in stats::cor for use=complete.obs with NAs
Arrrrr, I think I've found a bug in the behavior of the stats::cor function when NAs are present, but in case I'm missing something, could you look over this example and let me know what you think: > a = c(1,3,NA,1,2) > b = c(1,2,1,1,4) > cor(a,b,method="spearman", use="complete.obs") [1] 0.8164966 > cor(a,b,method="spearman",
2010 Jul 08
2
strsplit("dia ma", "\\b") splits characterwise
\b is word boundary. But, unexpectedly, strsplit("dia ma", "\\b") splits character by character. > strsplit("dia ma", "\\b") [[1]] [1] "d" "i" "a" " " "m" "a" > strsplit("dia ma", "\\b", perl=TRUE) [[1]] [1] "d" "i" "a" " "
2008 Sep 10
2
trouble printing from graphics device in R 2.7.2
Hi, I've been using R for many years and have always tried to keep my R version up to date, and when I switched from 2.7.1 to 2.7.2 I'm suddenly having trouble printing from the graphics device. I have Windows XP, and installed both versions of R from the binaries. If I start 2.7.2 and simply do: > plot(1:10) the default R Graphics Device window opens as usual. However, when I