[Rd] Specifying a long string literal across several lines

2025-05-27 Thread Pavel Krivitsky via R-devel
Dear All, Perhaps this should go in r-package-devel, but I suspect that this is going to turn into a feature request, and I want to run it by the list before filing it in the Bugzilla. I would like to specify a long string literal without making the line of code too long. In R, "abc def" yields

Re: [Rd] sqrt(.Machine$double.xmax)^2 == Inf, but only on Windows in R

2025-05-27 Thread Pavel Krivitsky via R-devel
ibera wrote: > > On 4/29/25 12:00, Martin Maechler wrote: > > > > > > > Pavel Krivitsky via R-devel > > > > > > > on Mon, 28 Apr 2025 05:13:41 + writes: > > > Hello, Under R 4.5.0 on Windows (x86-64), I get: > > > >

[Rd] sqrt(.Machine$double.xmax)^2 == Inf, but only on Windows in R

2025-04-27 Thread Pavel Krivitsky via R-devel
Hello, Under R 4.5.0 on Windows (x86-64), I get: > sqrt(.Machine$double.xmax)^2 [1] Inf > sqrt(.Machine$double.xmax)*sqrt(.Machine$double.xmax) [1] Inf On other hand on other platforms, including Debian Linux (x86-64), I get: d> sqrt(.Machine$double.xmax)^2 [1] 1.797693134862315508561e+308 d> s

Re: [Rd] [WARNING: POTENTIAL FORGED EMAIL] Augment base::replace(x, list, value) to allow list= to be a predicate?

2023-03-18 Thread Pavel Krivitsky
Dear All, Following up on this, I was wondering whether it might be possible to get a disposition from R developers. I did find a way to produce a similar effect reasonably concisely using call alchemy and lazy evaluation. The following function grabs the specified arguments in the function whose

Re: [Rd] Multiple Assignment built into the R Interpreter?

2023-03-12 Thread Pavel Krivitsky
Dear All, As a maintainer of large, complex packages, I can think of many places in which deconstructing assignment would simplify the code, as well as facilitate readability by breaking up larger functions into helpers, so I would be very glad to see this incorporated somehow. I think the crux o

Re: [Rd] Augment base::replace(x, list, value) to allow list= to be a predicate?

2023-03-07 Thread Pavel Krivitsky
Dear Serguei, On Mon, 2023-03-06 at 09:45 +0100, Serguei Sokol wrote: > Right, but anonymous function syntax can palliate to this: > > x |> (\(x) replace(x, is.na(x), 0))() This approach hardly makes for concise or readable code. > > Before modifying the base of R, we should examine existing >

[Rd] Augment base::replace(x, list, value) to allow list= to be a predicate?

2023-03-03 Thread Pavel Krivitsky
Dear All, Currently, list= in base::replace(x, list, value) has to be an index vector. For me, at least, the most common use case is for list= to be some simple property of elements of x, e.g., x <- c(1,2,NA,3) replace(x, is.na(x), 0) Particularly when using R pipes, which don't allow multiple s

Re: [Rd] [R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.

2019-05-19 Thread Pavel Krivitsky
take precedence within a namespace. The only situation in which it would change R's behaviour would be when a package/namespace contains a function foo.bar() AND a NAMESPACE containing S3method(foo,bar,not.foo.bar) AND calls foo() on objects of type bar from inside the package. It is extreme

Re: [Rd] [R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.

2019-05-18 Thread Pavel Krivitsky
uence above contradicts the current implementation (except for swapping 1 and 2)? As far as I can tell, it's just a more concrete description of what's in the documentation. Best Regards, Pavel -- Pavel Krivitsky Lecturer in Statisti

Re: [Rd] [R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.

2019-05-14 Thread Pavel Krivitsky
4. S3method() in other loaded packages' NAMESPACEs. 5. Appropriately named functions exported by other loaded packages' NAMESPACEs. For a call from outside a package, the precedence is the same, but 1 and 2 are not relevant. As far as I can tell, this is the current behaviour e

[Rd] Strange error messages from parallel::mcparallel family under 3.6.0

2019-05-03 Thread Pavel Krivitsky
prevent the child process from returning valid output, but I've never seen them before R 3.6.0, so I wonder if I am doing something wrong. Session info is also attached. Thanks in advance, Pavel -- Pavel Krivitsky Lecture