Re: [Rd] uniroot violates bounds?

2023-02-18 Thread J C Nash
I wrote first cut at unirootR for Martin M and he revised and put in Rmpfr. The following extends Ben's example, but adds the unirootR with trace output. c1 <- 4469.822 c2 <- 572.3413 f <- function(x) { c1/x - c2/(1-x) }; uniroot(f, c(1e-6, 1)) uniroot(f, c(1e-6, 1)) library(Rmpfr) unirootR(f, c

Re: [Rd] Adding support for S7 to base R

2023-02-18 Thread Duncan Murdoch
On 18/02/2023 9:51 a.m., Duncan Murdoch wrote: One more comment: The utils::setBreakpoint() function should be updated to be able to set breakpoints in S7 methods, or a substitute function should be added to the S7 package. RStudio 2022.12.0+353 (not sure if that's the latest) also needs to be

[Rd] uniroot violates bounds?

2023-02-18 Thread Ben Bolker
c1 <- 4469.822 c2 <- 572.3413 f <- function(x) { c1/x - c2/(1-x) }; uniroot(f, c(1e-6, 1)) uniroot(f, c(1e-6, 1)) provides a root at -6.00e-05, which is outside of the specified bounds. The default value of the "extendInt" argument to uniroot() is "no", as far as I can see ... $root [1]

Re: [Rd] Adding support for S7 to base R

2023-02-18 Thread Duncan Murdoch
One more comment: The utils::setBreakpoint() function should be updated to be able to set breakpoints in S7 methods, or a substitute function should be added to the S7 package. RStudio 2022.12.0+353 (not sure if that's the latest) also needs to be taught how to do that, since it doesn't seem

Re: [Rd] Adding support for S7 to base R

2023-02-18 Thread Duncan Murdoch
I hadn't been aware of the S7 project, but I've read some of the online docs about it. It looks like a nice evolution of S3 & S4. I have a few questions: Is the proposal is that these patches be included in the upcoming R 4.3.0? One minor thing missing from the docs (as far as I could see) is

[Rd] summary.lm fails for difftime objects

2023-02-18 Thread Gabor Grothendieck
lm works with difftime objects but then if you try to get the summary it fails with an error: fit <- lm(as.difftime(Time, units = "mins") ~ demand, BOD) summary(fit) ## Error in Ops.difftime((f - mean(f)), 2) : ## '^' not defined for "difftime" objects A number of other lm methods also f