Re: [R-pkg-devel] Options "reset" when options(opts)

2024-07-11 Thread Vladimir Dergachev
On Thu, 11 Jul 2024, David Hugh-Jones wrote: This surprised me, even though it shouldn’t have done. (My false internal model of the world was that oo <- options(); … options(oo) would overwrite the entire options list with the old values.) I wonder if it would be worth pointing out explicitly

Re: [R-pkg-devel] Options "reset" when options(opts)

2024-07-11 Thread David Hugh-Jones
This surprised me, even though it shouldn’t have done. (My false internal model of the world was that oo <- options(); … options(oo) would overwrite the entire options list with the old values.) I wonder if it would be worth pointing out explicitly in ?options. Writing: wyclif.substack.com Book: w

Re: [R-pkg-devel] Options "reset" when options(opts)

2024-07-10 Thread Greg Jefferis
Dear John, You need to collect the return value when setting options. This will include an explicit NULL value for an option that was previously NULL. Best, Greg Jefferis. options(digits.secs = NULL) noset2 = function() { opts <- options(digits.secs = 3) on.exit(options(opts)) print(op

[R-pkg-devel] Options "reset" when options(opts)

2024-07-10 Thread John Muschelli
When setting options in a function, I have always used the following: opts <- options() on.exit(options(opts), add = TRUE) and assumed it "reset" options to what they were prior to running the function. But for some options that are set to NULL, it does not seem to reset them. Specifically, I