[Rd] Suggestion: Make _R_CHECK_LENGTH_1_LOGIC2_=warn the default for R 3.6.2

2019-11-17 Thread Henrik Bengtsson
Hi, I'm not sure where we are in getting CRAN packages getting their _R_CHECK_LENGTH_1_LOGIC2_=true bugs fixed (*), but maybe it'd help to make _R_CHECK_LENGTH_1_LOGIC2_=warn the new default in the upcoming R 3.6.2? Warnings of type: $ R --vanilla > Sys.setenv("_R_CHECK_LENGTH_1_LOGIC2_" =

[Rd] BUG?: A copy of base::`+` (primitive) is not a clone but a "pointer"

2019-11-17 Thread Henrik Bengtsson
$ R --vanilla R version 3.6.1 (2019-07-05) -- "Action of the Toes" Copyright (C) 2019 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) ... > str(base::`+`) function (e1, e2) > plus <- structure(base::`+`, class = "plus") > str(plus) function (e1, e2) - attr(*,

Re: [Rd] Suggestion: Make _R_CHECK_LENGTH_1_LOGIC2_=warn the default for R 3.6.2

2019-11-18 Thread Henrik Bengtsson
.On Mon, Nov 18, 2019 at 12:35 AM Martin Maechler wrote: > > >>>>> Henrik Bengtsson > >>>>> on Sun, 17 Nov 2019 20:42:32 -0800 writes: > > > Hi, > > > I'm not sure where we are in getting CRAN packages getting their > >

Re: [Rd] Suggestion: Make _R_CHECK_LENGTH_1_LOGIC2_=warn the default for R 3.6.2

2019-11-18 Thread Henrik Bengtsson
On Mon, Nov 18, 2019 at 6:55 AM Tomas Kalibera wrote: > > On 11/18/19 3:44 PM, Henrik Bengtsson wrote: > > .On Mon, Nov 18, 2019 at 12:35 AM Martin Maechler > > wrote: > >>>>>>> Henrik Bengtsson > >>>>>>> on Sun, 17 No

Re: [Rd] _R_CHECK_LENGTH_1_LOGIC2_ setting and Rstudio ..

2019-11-15 Thread Henrik Bengtsson
Yes, I ran into this too. I think they fixed it for RStudio 1.3 (https://github.com/rstudio/rstudio/pull/5457/files). My workaround is to enable these checks conditionally on not running R in the RStudio Console (it works in the RStudio Terminal). To test for the RStudio Console, you need to

Re: [Rd] Patch idea: an environment variable for setting the user ID

2019-11-22 Thread Henrik Bengtsson
Another thing to consider if one wants to anonymize the build is the UID/GID of the files in the tarball. So there might be a need for a R_BUILD_UID and R_BUILD_GID, e.g. by setting those to 32767 ("nobody"). /Henrik On Fri, Jan 25, 2019 at 9:25 AM Will L wrote: > > Thanks, Kurt. > > I think I

Re: [Rd] switch to reference counting in R-devel

2019-12-03 Thread Henrik Bengtsson
This is very exciting news. Luke, thank you for all your work on this - I know it's been a long journey. All the best, Henrik On Tue, Dec 3, 2019 at 8:04 AM Tierney, Luke wrote: > > R-devel has been switched to use reference counting by default with > r77508. Building with -DSWITCH_TO_NAMED

[Rd] R-specific environment variables: Naming convention?

2019-10-09 Thread Henrik Bengtsson
In base R, there are lots of environment variables with either prefix 'R_' or '_R_', e.g. R_ENABLE_JIT and _R_RNG_VERSION_. I always considered R_* variables to be "public" and _R_*_ ones being "internal" but realized I don't have a reference for this. Is this true, or is there another reason?

Re: [Rd] tcl problem with R-3.6.3?

2020-02-29 Thread Henrik Bengtsson
Here's a simpler example that should reproduce that error for you: ans <- utils::select.list(c("hello", "world", "again"), graphics=TRUE) Does it? FYI, I installed R 3.6.3 from source on CentOS 7 a few hours ago, and for me the above works just fine. For your immediate needs of selecting a

Re: [Rd] methods package: A _R_CHECK_LENGTH_1_LOGIC2_=true error

2020-02-14 Thread Henrik Bengtsson
gt; Martin Maechler > >>>>> on Sat, 29 Jun 2019 10:33:10 +0200 writes: > > >>>>> peter dalgaard > >>>>> on Fri, 28 Jun 2019 16:20:03 +0200 writes: > > >>> > On 28 Jun 2019, at 16:03 ,

Re: [Rd] SUGGESTION: Settings to disable forked processing in R, e.g. parallel::mclapply()

2020-01-10 Thread Henrik Bengtsson
t not all use cases of async processing is about parallelization, so it might not apply everywhere). Cheers, Henrik > > Cheers, > Simon > > > > > On Jan 10, 2020, at 10:58 AM, Henrik Bengtsson > > wrote: > > > > The RStudio GUI was just one example. AFAIK

Re: [Rd] SUGGESTION: Settings to disable forked processing in R, e.g. parallel::mclapply()

2020-01-11 Thread Henrik Bengtsson
ue to troubleshooting and helping others remotely on problems related to instability of forked processing. Being able to disable it, would have shortcut this quite a bit. /Henrik > > Cheers, > Simon > > > > > On Jan 10, 2020, at 3:34 PM, Henrik Bengtsson > > wrote: >

Re: [Rd] as-cran issue ==> set _R_CHECK_LENGTH_1_* settings!

2020-01-14 Thread Henrik Bengtsson
On Tue, Jan 14, 2020 at 1:32 PM Marc Schwartz via R-devel wrote: > > > On Jan 14, 2020, at 3:29 PM, Abby Spurdle wrote: > > > >> I do want to entice people to have a long look beyond closed > >> source OS into the world of Free Software where not only R is > >> FOSS (Free and Open Source

Re: [Rd] SUGGESTION: Settings to disable forked processing in R, e.g. parallel::mclapply()

2020-01-10 Thread Henrik Bengtsson
nctionality requested here can be easily > implemented in a package so R doesn’t need to be modified. > > Cheers, > Simon > > Sent from my iPhone > > >> On Jan 10, 2020, at 04:34, Tomas Kalibera wrote: > >> > >> On 1/10/20 7:33 AM, Henrik Bengtsson wr

Re: [Rd] SUGGESTION: Settings to disable forked processing in R, e.g. parallel::mclapply()

2020-01-09 Thread Henrik Bengtsson
I'd like to pick up this thread started on 2019-04-11 (https://hypatia.math.ethz.ch/pipermail/r-devel/2019-April/077632.html). Modulo all the other suggestions in this thread, would my proposal of being able to disable forked processing via an option or an environment variable make sense? I've

Re: [Rd] Another wish (?) for R 4.0.0: print(*, width = )

2020-01-07 Thread Henrik Bengtsson
On Tue, Jan 7, 2020 at 6:14 AM brodie gaslam via R-devel wrote: > > For whatever my 2c are worth I think this would be nice. I'm still > uncomfortable at having to call `options` in my package `diffobj` to set > output width. Adding a few more cents: It might be worth considering "who"

Re: [Rd] suggestion: "." in [lsv]apply()

2020-04-16 Thread Henrik Bengtsson
I'm sure this exists elsewhere, but, as a trade-off, could you achieve what you want with a separate helper function F(expr) that constructs the function you want to pass to [lsv]apply()? Something that would allow you to write: sapply(split(mtcars, mtcars$cyl), F(summary(lm(mpg ~

Re: [Rd] Add a new environment variable switch for the 'large version' check

2020-04-16 Thread Henrik Bengtsson
I'd second Jim's feature request - it would be useful to be able to disable this in CI and elsewhere.The concept of using an "unusual" version component such as a very large number does a nice job of indicating "unusual" and serves as a blocker for submitting work-in-progress to CRAN by

Re: [Rd] stringsAsFactors

2020-04-13 Thread Henrik Bengtsson
While at it, would it be worth mentioning in the NEWS for R 4.0.0 that options 'stringsAsFactors' is being deprecated, e.g. $ options(stringsAsFactors = TRUE) Warning message: In options(stringsAsFactors = TRUE) : 'options(stringsAsFactors = TRUE)' is deprecated and will be disabled ?

Re: [Rd] WISH: Sys.setlocale() to return value invisibly

2020-03-25 Thread Henrik Bengtsson
sion. https://bugs.r-project.org/bugzilla/show_bug.cgi?id=15128#c1 /Henrik On Tue, Mar 20, 2018 at 2:11 PM Henrik Bengtsson wrote: > > Contrary to, say, Sys.setenv(), Sys.setlocale() returns it's value > visibly. This means that if you for instance add: > > Sys.setlocale(&qu

Re: [Rd] R CMD check --as-cran attempts to hide R_LIBS_USER but fails

2020-03-24 Thread Henrik Bengtsson
n Windows (see, there's some advantages to be on that OS). /Henrik On Wed, Mar 18, 2020 at 9:38 PM Henrik Bengtsson wrote: > > On Wed, Mar 18, 2020 at 8:04 PM Dirk Eddelbuettel wrote: > > > > > > On 18 March 2020 at 19:19, Henrik Bengtsson wrote: > > | AFAIU, 'R

Re: [Rd] mclapply returns NULLs on MacOS when running GAM

2020-04-28 Thread Henrik Bengtsson
Hi, a few comments below. First, from my experience and troubleshooting similar reports from others, a returned NULL from parallel::mclapply() is often because the corresponding child process crashed/died. However, when this happens you should see a warning, e.g. > y <- parallel::mclapply(1:2,

Re: [Rd] mclapply returns NULLs on MacOS when running GAM

2020-04-28 Thread Henrik Bengtsson
>> include it my initial email. It sounds like an RStudio issue, and it seems > >> like that it’s quite intrinsic to how forks interact with RStudio. Given > >> this code is eventually going to be a part of a package, should I expect > >> it to

Re: [Rd] defining r audio connections

2020-05-06 Thread Henrik Bengtsson
What's the gist of the problem of making/having this part of the public API? Is it security, is it stability, is it that the current API is under construction, is it a worry about maintenance load for R Core, ...? Do we know why? It sounds like it's a feature that is useful. I think we missed

Re: [Rd] R CMD check --as-cran attempts to hide R_LIBS_USER but fails

2020-03-18 Thread Henrik Bengtsson
On Wed, Mar 18, 2020 at 8:04 PM Dirk Eddelbuettel wrote: > > > On 18 March 2020 at 19:19, Henrik Bengtsson wrote: > | AFAIU, 'R CMD check --as-cran' tries to hide any site and user package > | libraries by setting R_LIBS_SITE and R_LIBS_USER. However, contrary > >

[Rd] R CMD check --as-cran attempts to hide R_LIBS_USER but fails

2020-03-18 Thread Henrik Bengtsson
AFAIU, 'R CMD check --as-cran' tries to hide any site and user package libraries by setting R_LIBS_SITE and R_LIBS_USER. However, contrary to R_LIBS_SITE, it fails for R_LIBS_USER and the user's personal library is still available for test scripts. Should I revise my assumptions, or is that

Re: [Rd] Precision of function mean,bug?

2020-05-20 Thread Henrik Bengtsson
On Wed, May 20, 2020 at 11:10 AM brodie gaslam via R-devel wrote: > > > On Wednesday, May 20, 2020, 7:00:09 AM EDT, peter dalgaard > wrote: > > > > Expected, see FAQ 7.31. > > > > You just can't trust == on FP operations. Notice also > > Additionally, since you're implementing a "mean"

Re: [Rd] Compatibility issues caused by new simplify argument in apply function

2020-05-22 Thread Henrik Bengtsson
Interesting problem. I'm very rusty on S4 but would one solution be to, already now, add 'simplify = TRUE' to the S4 method and document it; setMethod("apply", signature(X = "Speclib"), function(X, FUN, bySI = NULL, ...,

Re: [Rd] Rgui never processes ~/.Renviron

2020-09-09 Thread Henrik Bengtsson
I've "moved" this to https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17919 to make sure it's tracked. /Henrik On Thu, Sep 3, 2020 at 7:25 AM Dirk Eddelbuettel wrote: > > > On 2 September 2020 at 23:38, Henrik Bengtsson wrote: > | WORKAROUND: > | Setting R_USER or H

[Rd] Rgui never processes ~/.Renviron

2020-09-03 Thread Henrik Bengtsson
ISSUE: It looks like Rgui.exe never processes ~/.Renviron - only ./.Renviron. REPRODUCIBLE EXAMPLE: On Windows, create the following ~/.Renviron and ~/.Rprofile files: C:\Users\alice> Rscript -e "cat('FOO=123\n', file='~/.Renviron')" C:\Users\alice> Rscript -e "cat('print(Sys.getenv(\'FOO\'))',

[Rd] Bug in stats:::`[.formula`: (~ NULL)[2] gives Error ... missing value where TRUE/FALSE needed

2020-08-14 Thread Henrik Bengtsson
Hi, it looks like: > stats:::`[.formula` function (x, i) { ans <- NextMethod("[") if (length(ans) == 0L || as.character(ans[[1L]])[1L] == "~") { class(ans) <- "formula" environment(ans) <- environment(x) } ans } doesn't like to extract NULL components on either

[Rd] Restrict package to load-only access - prevent attempts to attach it

2020-06-23 Thread Henrik Bengtsson
Hi, I'm developing a package whose API is only meant to be used in other packages via imports or pkg::foo(). There should be no need to attach this package so that its API appears on the search() path. As a maintainer, I want to avoid having it appear in search() conflicts by mistake. This

Re: [Rd] r-project.org SSL certificate issues

2020-06-09 Thread Henrik Bengtsson
Was this resolved upstream or is this something that R should/could fix? If the latter, could this also go into the "emergency release" R 4.0.2 that is scheduled for 2020-06-22? My $.02 /Henrik On Sun, May 31, 2020 at 8:13 AM Gábor Csárdi wrote: > > Btw. it would be also possible to create a

Re: [Rd] Restrict package to load-only access - prevent attempts to attach it

2020-07-17 Thread Henrik Bengtsson
gt; Hi Henrik, > > A bit late, but you can take a look at smbache's {import} package [1] > in case you didn't know it. I believe it does what you are describing. > > [1] https://github.com/smbache/import > > Iñaki > > On Tue, 23 Jun 2020 at 22:21, Henrik Bengtsson > wrote

Re: [Rd] return (x+1) * 1000

2020-11-20 Thread Henrik Bengtsson
FWIW, 'R CMD check --as-cran' in R-devel checks for "bogus return" statements but I think that's only for the case when one forgets the parentheses, e.g. 'return' instead of 'return()'. I don't think it catches this case but I'm also not sure. Though, I can imagine it might be possible to enhance

Re: [Rd] return (x+1) * 1000

2020-11-20 Thread Henrik Bengtsson
Without having dug into the details, it could be that one could update the parser by making a 'return' a keyword and require it to be followed by a parenthesis that optionally contains an expression followed by end of statement (newline or semicolon). Such a "promotion" of the 'return' statement

Re: [Rd] Process to Incorporate Functions from {parallely} into base R's {parallel} package

2020-11-07 Thread Henrik Bengtsson
us. Reverse SSH tunneling is super simply; all you need to to is something like: rshopts <- c(sprintf("-R %d:%s:%d", rscript_port, master, port), rshopts) /Henrik On Fri, Nov 6, 2020 at 4:37 PM Duncan Murdoch wrote: > > On 06/11/2020 4:47 p.m., Balamuta, James Joseph wrote: >

[Rd] R for Windows leaves detritus in the temp directory

2021-06-15 Thread Henrik Bengtsson
ISSUE: The TMPDIR validation done in src/gnuwin32/system.c: /* in case getpid() is not unique -- has been seen under Windows */ snprintf(ifile, 1024, "%s/Rscript%x%x", tm, getpid(), (unsigned int) GetTickCount()); ifp = fopen(ifile, "w+b"); if(!ifp) R_Suicide(_("creation

Re: [Rd] Testing R build when using --without-recommended-packages?

2021-05-05 Thread Henrik Bengtsson
On Wed, May 5, 2021 at 2:13 AM Martin Maechler wrote: > > > Gabriel Becker > > on Tue, 4 May 2021 14:40:22 -0700 writes: > > > Hmm, that's fair enough Ben, I stand corrected. I will say that this > seems > > to be a pretty "soft" recommendation, as these things go, given

Re: [Rd] R compilation on old(ish) CentOS

2021-04-30 Thread Henrik Bengtsson
Ben, it's most like what Peter says. I can confirm it works; I just installed https://cran.r-project.org/src/base-prerelease/R-latest.tar.gz on an up-to-date CentOS 7.9.2009 system using the vanilla gcc (GCC) 4.8.5 that comes with that version and R compiles just fine and it passes 'make check'

Re: [Rd] Testing R build when using --without-recommended-packages?

2021-05-04 Thread Henrik Bengtsson
;Failed with error: 'there is no package called 'nlme'". (*) BTW, '../bin/R CMD make test-BasePackages' gives "make: *** No rule to make target 'test-BasePackages'. Stop." Thanks, /Henrik On Tue, May 4, 2021 at 12:22 PM Dirk Eddelbuettel wrote: > > > On 4 May 2021

[Rd] Testing R build when using --without-recommended-packages?

2021-05-04 Thread Henrik Bengtsson
I'm on Linux (Ubuntu 18.04). How do I check an R build when using --without-recommended-packages? 'make check' assumes 'recommended' packages are installed, so that fails without them available. DETAILS: When I build R from source without 'recommended' packages: curl -O

Re: [Rd] Testing R build when using --without-recommended-packages?

2021-05-04 Thread Henrik Bengtsson
for a way to validate such an installation. If your comment is on the 'stats' examples' hard dependency on 'MASS' despite it's being a suggested packages, I still don't follow. /Henrik On Tue, May 4, 2021 at 10:16 AM Dirk Eddelbuettel wrote: > > > On 4 May 2021 at 09:31, Henrik Bengts

Re: [Rd] Testing R build when using --without-recommended-packages?

2021-05-04 Thread Henrik Bengtsson
FWIW, $ ./configure --help ... --with-recommended-packages use/install recommended R packages [yes] /Henrik On Tue, May 4, 2021 at 11:17 AM Dirk Eddelbuettel wrote: > > > On 4 May 2021 at 11:07, Henrik Bengtsson wrote: > | Thanks, but I don't understand.

[Rd] help(".libPaths"): Paragraph lacks mentioning of R_LIBS_SITE

2021-04-19 Thread Henrik Bengtsson
In ?base::.libPaths, there's a paragraph saying: The library search path is initialized at startup from the environment variable R_LIBS (which should be a colon-separated list of directories at which R library trees are rooted) followed by those in environment variable R_LIBS_USER. Only

Re: [Rd] Force quitting a FORK cluster node on macOS and Solaris wreaks havoc

2021-08-16 Thread Henrik Bengtsson
Thank you Simon, this is helpful. I take this is specific to quit(), so it's a poor choice for emulating crashed parallel workers, and Sys.kill() is much better for that. I was focusing on that odd extra execution/output, but as you say, there are lots of other things that is done by quit()

[Rd] WISH: set.seed(seed) to produce error if length(seed) != 1 (now silent)

2021-09-17 Thread Henrik Bengtsson
Hi, according to help("set.seed"), argument 'seed' to set.seed() should be: a single value, interpreted as an integer, or NULL (see ‘Details’). >From code inspection (src/main/RNG.c) and testing, it turns out that if you pass a 'seed' with length greater than one, it silently uses seed[1],

Re: [Rd] WISH: set.seed(seed) to produce error if length(seed) != 1 (now silent)

2021-09-17 Thread Henrik Bengtsson
warning or error with set.seed(). > > Validating inputs and emitting errors early is a good practice. > > Just my 2 cents. > > Sincerely. > Andre GILLIBERT > > -Message d'origine- > De : R-devel [mailto:r-devel-boun...@r-project.org] De la part de Avraham > Adler &

Re: [Rd] WISH: set.seed(seed) to produce error if length(seed) != 1 (now silent)

2021-09-17 Thread Henrik Bengtsson
gt; > runif(1) > [1] 0.3842704 > > > sum(.Random.seed) > [1] -13435151647 > > # So let's make things really random, by using the new seed as a seed: > > set.seed(.Random.seed) > > sum(.Random.seed) > [1] 24428993419 > > # Back to the original! > >

[Rd] Force quitting a FORK cluster node on macOS and Solaris wreaks havoc

2021-08-12 Thread Henrik Bengtsson
The following smells like a bug in R to me, because it puts the main R session into an unstable state. Consider the following R script: a <- 42 message("a=", a) cl <- parallel::makeCluster(1L, type="FORK") try(parallel::clusterEvalQ(cl, quit(save="no"))) message("parallel:::isChild()=",

Re: [Rd] R-devel: as.character() for hexmode no longer pads with zeros

2021-09-23 Thread Henrik Bengtsson
if this is a property we should all strive for for other types of objects? /Henrik On Thu, Sep 23, 2021 at 12:46 AM Martin Maechler wrote: > > >>>>> Henrik Bengtsson > >>>>> on Wed, 22 Sep 2021 20:48:05 -0700 writes: > > > The update in rev 80946 &g

Re: [Rd] Fwd: Using existing envars in Renviron on friendly Windows

2021-10-20 Thread Henrik Bengtsson
Two comments/suggestions: 1. What about recommending to always quote the value in Renviron files, e.g. ABC="Hello world" and DEF="${APPDATA}/R-library"? This should a practice that works on all platforms. 2. What about having readRenviron() escapes strings it imports via environment variables?

[Rd] BUG?: R CMD check with --as-cran *disables* checks for unused imports otherwise performed

2021-10-20 Thread Henrik Bengtsson
ISSUE: Using 'R CMD check' with --as-cran, set_R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_=TRUE, whereas the default is FALSE, which you get if you don't add --as-cran. I would expect --as-cran to check more things and more be conservative than without. So, is this behavior a mistake? Could it

[Rd] R-devel: as.character() for hexmode no longer pads with zeros

2021-09-22 Thread Henrik Bengtsson
The update in rev 80946 (https://github.com/wch/r-source/commit/d970867722e14811e8ba6b0ba8e0f478ff482f5e) caused as.character() on hexmode objects to no longer pads with zeros. Before: > x <- structure(as.integer(c(0,8,16,24,32)), class="hexmode") > x [1] "00" "08" "10" "18" "20" >

[Rd] mapply(): Special case of USE.NAMES=TRUE with recent R-devel updates

2021-11-30 Thread Henrik Bengtsson
Hi, in R-devel (4.2.0), we now get: > mapply(paste, "A", character(), USE.NAMES = TRUE) named list() Now, in ?mapply we have: USE.NAMES: logical; use the names of the first ... argument, or if that is an unnamed character vector, use that vector as the names. This basically says we should

Re: [Rd] How can a package be aware of whether it's on CRAN

2021-11-23 Thread Henrik Bengtsson
On Tue, Nov 23, 2021 at 12:06 PM Gábor Csárdi wrote: > > On Tue, Nov 23, 2021 at 8:49 PM Henrik Bengtsson > wrote: > > > > > Is there any reliable way to let packages to know if they are on CRAN, so > > > they can set omp cores to 2 by default? > &

Re: [Rd] How can a package be aware of whether it's on CRAN

2021-11-23 Thread Henrik Bengtsson
> Is there any reliable way to let packages to know if they are on CRAN, so > they can set omp cores to 2 by default? Instead of testing for "on CRAN" or not, you can test for 'R CMD check' running or not. 'R CMD check' sets environment variable _R_CHECK_LIMIT_CORES_=TRUE. You can use that to

[Rd] DOCS: Exactly when, in the signaling process, is option 'warn' applied?

2021-11-18 Thread Henrik Bengtsson
Hi, the following question sprung out of a package settings option warn=-1 to silence warnings, but those warnings were still caught by withCallingHandlers(..., warning), which the package author did not anticipate. The package has been updated to use suppressWarnings() instead, but as I see a

Re: [Rd] Fwd: Using existing envars in Renviron on friendly Windows

2021-10-30 Thread Henrik Bengtsson
> ... If one still needed backslashes, > they could then be entered in single quotes, e.g. VAR='c:\users'. I don't think it matters whether you use single or double quotes - both will work. Here's a proof of concept on Linux with R 4.1.1: $ cat ./.Renviron A=C:\users B='C:\users' C="C:\users"

Re: [Rd] BUG?: R CMD check with --as-cran *disables* checks for unused imports otherwise performed

2021-11-02 Thread Henrik Bengtsson
the time (May 2020). See "Dependencies NOTE lost with > --as-cran" (https://stat.ethz.ch/pipermail/r-package-devel/2020q2/005467.html) > > On Wed, Oct 20, 2021 at 11:55 PM Henrik Bengtsson > wrote: >> >> ISSUE: >> >> Using 'R CMD check' with --as-cr

Re: [Rd] Fwd: Using existing envars in Renviron on friendly Windows

2021-11-02 Thread Henrik Bengtsson
ER=[${R_LIBS_USER}]" R_LIBS_USER=[C:\Users\foobar\AppData\Roaming\R-library] /Henrik On Sun, Oct 31, 2021 at 2:59 AM Tomas Kalibera wrote: > > > On 10/31/21 2:55 AM, Henrik Bengtsson wrote: > >> ... If one still needed backslashes, > >> they could then be entered

[Rd] gettext(msgid, domain="R") doesn't work for some 'msgid':s

2021-11-05 Thread Henrik Bengtsson
I'm trying to reuse some of the translations available in base R by using: gettext(msgid, domain="R") This works great for most 'msgid's, e.g. $ LANGUAGE=de Rscript -e 'gettext("cannot get working directory", domain="R")' [1] "kann das Arbeitsverzeichnis nicht ermitteln" However, it does not

Re: [Rd] capturing multiple warnings in tryCatch()

2021-12-02 Thread Henrik Bengtsson
Simon's suggestion with withCallingHandlers() is the correct way. Also, note that if you use tryCatch() to catch warnings, you're *interrupting* the evaluation of the expression of interest, e.g. > res <- tryCatch({ message("hey"); warning("boom"); message("there"); 42 }, > warning = function(w)

[Rd] R-devel: as.vector(x, mode = "list") drops attributes despite documented not to

2021-12-01 Thread Henrik Bengtsson
Hi, in R 4.1.2 we have: > x <- structure(as.list(1:2), dim = c(1,2)) > x [,1] [,2] [1,] 12 > as.vector(x, mode = "list") [,1] [,2] [1,] 12 whereas in recent versions of R-devel (4.2.0) we have: > x <- structure(as.list(1:2), dim = c(1,2)) > x [,1] [,2] [1,] 12 >

[Rd] MS Windows: R does not escape quotes in CLI options the same way as Rterm and Rscript

2021-12-15 Thread Henrik Bengtsson
On MS Windows 10, the following works: > Rscript --vanilla -e "\"abc\"" [1] "abc" and also: > Rterm --vanilla --no-echo -e "\"abc.txt\"" [1] "abc.txt" whereas attempting the same with 'R' fails; > R --vanilla --no-echo -e "\"abc.txt\"" Error: object 'abc' not found Execution halted I get

Re: [Rd] dim<-() changed in R-devel; no longer removing "dimnames" when doing dim(x) <- dim(x)

2023-11-01 Thread Henrik Bengtsson
The discussion on whether certain R expressions (e.g. dim(x) <- dim(x)) should be no-op is interesting, but it's much bigger, and I can see how it becomes a quite complicated discussion. Thanks, Henrik On Mon, Oct 30, 2023 at 3:53 AM Martin Maechler wrote: > > > >>>>&

[Rd] dim<-() changed in R-devel; no longer removing "dimnames" when doing dim(x) <- dim(x)

2023-10-29 Thread Henrik Bengtsson
Hello, the fix of PR18612 (https://bugs.r-project.org/show_bug.cgi?id=18612) in r85380 (https://github.com/wch/r-source/commit/2653cc6203fce4c48874111c75bbccac3ac4e803) caused a change in `dim<-()`. Specifically, in the past, any `dim<-()` assignment would _always_ remove "dimnames" and "names"

Re: [Rd] Bug report: parLapply with capture.output(type="message") produces an error

2023-10-05 Thread Henrik Bengtsson
This is actually not a bug. If we really want to identify a bug, then it's actually a bug in your code. We'll get to that at the very end. Either way, it's an interesting report that reveals a lot of things. First, here's a slightly simpler version of your example: $ Rscript --vanilla -e

Re: [Rd] Typo in Renviron.site in R 4.2.0 on Ubuntu?

2022-05-08 Thread Henrik Bengtsson
> ... The extra apostrophe does not seem to have created an issue during all > those tests, or since, under either Debian or Ubuntu. I think that is because the system library '/usr/lib/R/library' is always appended at the end of the library path, so that non-existing to folder (the one with the

Re: [Rd] [External] Time to drop globalenv() from searches in package code?

2022-10-05 Thread Henrik Bengtsson
Excluding the global environment, and all its parent environments from the search path that a package sees would be great news, because it would makes things more robust and probably detect a few more bugs out there. In addition to the use case that Duncan mentions, it would also remove the

Re: [Rd] Rscript -e EXPR fails to launch if stdin is closed

2022-10-10 Thread Henrik Bengtsson
t 0, so the test on ifd (and I suppose > > also the one on ifp) is wrong. And of course, once you close file > > descriptor 0, mkstemp() chooses the 1st available fd, i.e. 0, for its > > return value. > > > > -pd > > > >> On 9 Oct 2022, at

[Rd] Rscript -e EXPR fails to launch if stdin is closed

2022-10-09 Thread Henrik Bengtsson
Rscript fails to launch if the standard input (stdin) is closed, e.g. $ Rscript --vanilla -e 42 0<&- Fatal error: creating temporary file for '-e' failed This appear to only happen with `-e EXPR`, e.g. it works when doing: $ echo "42" > script.R $ Rscript --vanilla script.R 0<&- [1] 42 and: $

Re: [Rd] R-devel: toLatex() for sessionInfo needs to escape new 'Time zone' entry

2022-12-05 Thread Henrik Bengtsson
I've moved this to https://bugs.r-project.org/show_bug.cgi?id=18443. /Henrik On Wed, Nov 30, 2022 at 2:03 PM Henrik Bengtsson wrote: > > BACKGROUND: > > In recent versions of R-devel, sessionInfo() has a 'tzone' element, e.g. > > > sessionInfo()$tzone > [1] "Ame

[Rd] R-devel: toLatex() for sessionInfo needs to escape new 'Time zone' entry

2022-11-30 Thread Henrik Bengtsson
BACKGROUND: In recent versions of R-devel, sessionInfo() has a 'tzone' element, e.g. > sessionInfo()$tzone [1] "America/Los_Angeles" ISSUE: Some time zones, like the one above, has an underscore. This underscore is *not* escaped by utils:::toLatex.sessionInfo, e.g. $

[Rd] Sys.getenv(): Error in substring(x, m + 1L) : invalid multibyte string at '' if an environment variable contains \xFF

2023-01-30 Thread Henrik Bengtsson
/Hello. SUMMARY: $ BOOM=$'\xFF' LC_ALL=en_US.UTF-8 Rscript --vanilla -e "Sys.getenv()" Error in substring(x, m + 1L) : invalid multibyte string at '' $ BOOM=$'\xFF' LC_ALL=en_US.UTF-8 Rscript --vanilla -e "Sys.getenv('BOOM')" [1] "\xff" BACKGROUND: I launch R through an Son of Grid Engine (SGE)

Re: [Rd] Sys.getenv(): Error in substring(x, m + 1L) : invalid multibyte string at '' if an environment variable contains \xFF

2023-01-30 Thread Henrik Bengtsson
nd > Sys.getenv()[["FOO"]] should not yield two different results. I would argue > that if we want to make specific checks, we should make them conditional - > even if the default is to add them. Again, the error is due to the > implementation of Sys.getenv() breaking in R-

Re: [Rd] Request: better default R_LIBS_USER

2023-03-16 Thread Henrik Bengtsson
> Your best bet really to govern your .libPaths from your Rprofile.site and Renviron.site ... To do this for any version of R, one can add: R_LIBS_USER=~/.local/share/R/%p-library/%v to ~/.Renviron or the Renviron.site file. This automatically expands to the platform and R x.y version early on

[Rd] WISH: Optional mechanism preventing var <<- value from assigning non-existing variable

2023-03-19 Thread Henrik Bengtsson
I'd like to be able to prevent the <<- assignment operator ("super assignment") from assigning to the global environment unless the variable already exists and is not locked. If it does not exist or is locked, I'd like an error to be produced. This would allow me to evaluate expressions with

[Rd] CRAN 'R Sources' page: Provide link to https://svn.r-project.org/R/

2023-03-19 Thread Henrik Bengtsson
Not sure who is the webadmin for https://cran.r-project.org/sources.html, so posting it here: I just noticed it's not straightforward to find the Subversion URL for the R source code. A natural search would be to go to https://cran.r-project.org/, then click 'Source code' to get to

Re: [Rd] [External] subfolders in the R folder

2023-03-28 Thread Henrik Bengtsson
A quick drive-by-comment: What if 'R CMD build' would have an option to flatten R/ subfolders when building the tarball, e.g. R/unix/a.R R/windows/a.R R/a.R becomes: R/00__unix__a.R R/00__windows__a.R R/a.R ? Maybe that would be sufficient for most use cases. The only thing I can imagine is

Re: [Rd] Compiling R-devel on older Linux distributions, e.g. RHEL / CentOS 7

2023-02-08 Thread Henrik Bengtsson
On Wed, Feb 8, 2023 at 12:22 PM Iñaki Ucar wrote: > > On Wed, 8 Feb 2023 at 19:59, Henrik Bengtsson > wrote: > > > > I just want to add a few reasons that I know of for why users are > > still on Red Hat/CentOS 7 and learned from being deeply involved with > &g

Re: [Rd] need help from someone know screen reader and R high DPI GUI

2023-02-08 Thread Henrik Bengtsson
Thanks for this work. My suggestion would be to provide those pre-built Windows binaries to maximize the chances to get the feedback you need. The amount of people ready to, or have the setup to, build R from source, especially so on MS Windows, is much smaller than those who are willing to give

Re: [Rd] Compiling R-devel on older Linux distributions, e.g. RHEL / CentOS 7

2023-02-08 Thread Henrik Bengtsson
I just want to add a few reasons that I know of for why users are still on Red Hat/CentOS 7 and learned from being deeply involved with big academic and research high-performance compute (HPC) environments. These systems are not like your regular sailing boat, but more like a giant container ship;

Re: [Rd] save.image Non-responsive to Interrupt

2023-05-02 Thread Henrik Bengtsson
Along the lines of calling R_CheckUserInterrupt() only onces in a while: > OTOH, in the past we have had to *disable* R_CheckUserInterrupt() > in parts of R's code because it was too expensive, > {see current src/main/{seq.c,unique.c} for a series of commented-out > R_CheckUserInterrupt() for

Re: [Rd] save.image Non-responsive to Interrupt

2023-05-04 Thread Henrik Bengtsson
On Thu, May 4, 2023 at 3:02 PM Serguei Sokol via R-devel wrote: > > Le 03/05/2023 à 01:25, Henrik Bengtsson a écrit : > > Along the lines of calling R_CheckUserInterrupt() only onces in a while: > > > >> OTOH, in the past we have had to *disable* R_CheckUserInterrupt(

Re: [Rd] round.Date and trunc.Date not working / implemented

2024-02-08 Thread Henrik Bengtsson
Technically, there is a round() for 'Date' objects, but it doesn't seem very useful, because it basically just fall back to the default round() method, which only takes the 'digits' argument. Here's an example: > date <- Sys.Date() > class(date) [1] "Date" We see that there are only two round()

Re: [Rd] [EXTERNAL] Re: NOTE: multiple local function definitions for ?fun? with different formal arguments

2024-02-06 Thread Henrik Bengtsson
Here's a dummy example that I think illustrates the problem: toto <- function() { if (runif(1) < 0.5) function(a) a else function(a,b) a+b } > fcn <- toto() > fcn(1,2) [1] 3 > fcn <- toto() > fcn(1,2) [1] 3 > fcn <- toto() > fcn(1,2) Error in fcn(1, 2) : unused argument (2) How can

[Rd] tools::startDynamicHelp(): Randomly prevents R from exiting (on MS Windows)

2024-01-06 Thread Henrik Bengtsson
ISSUE: On MS Windows, running cmd.exe, calling Rscript --vanilla -e "port <- tools::startDynamicHelp(); port; port <- tools::startDynamicHelp(FALSE); port" will sometimes stall R at the end, preventing it from existing. This also happens when running R in interactive mode. It seems to stem

Re: [Rd] tools::startDynamicHelp(): Randomly prevents R from exiting (on MS Windows)

2024-01-06 Thread Henrik Bengtsson
> > > > Original Message ---- > On Jan 6, 2024, 12:38, Henrik Bengtsson < henrik.bengts...@gmail.com> wrote: > > > ISSUE: On MS Windows, running cmd.exe, calling Rscript --vanilla -e "port <- > tools::startDynamicHelp(); port; port <- tools::st

Re: [Rd] capture error messages from loading shared objects

2023-11-28 Thread Henrik Bengtsson
Careful; tryCatch() on non-error conditions will break out of what's evaluated, e.g. res <- tryCatch({ cat("1\n") message("2") cat("3\n") 42 }, message = identity) will output '1' but not '3', because it returns as soon as the first message() is called. To "record" messages (same for

Re: [Rd] Ordered comparison operators on language objects will signal errors

2024-03-04 Thread Henrik Bengtsson
On Mon, Mar 4, 2024 at 8:45 AM luke-tierney--- via R-devel wrote: > > Comparison operators == and != can be used on language objects > (i.e. call objects and symbols). The == operator in particular often > seems to be used as a shorthand for calling identical(). The current > implementation

Re: [Rd] Wish: a way to track progress of parallel operations

2024-03-25 Thread Henrik Bengtsson
Hello, thanks for bringing this topic up, and it would be excellent if we could come of with a generic solution for this in base R. It is one of the top frequently asked questions and requested features in parallel processing, but also in sequential processing. We have also seen lots of variants

Re: [Rd] [External] Re: Is ALTREP "non-API"?

2024-04-24 Thread Henrik Bengtsson
On Wed, Apr 24, 2024 at 1:32 PM luke-tierney--- via R-devel wrote: > > On Wed, 24 Apr 2024, Hadley Wickham wrote: > > >> > >> > >> > > That is not true at all - the presence of header does not constitute > declaration of something as the R API. There are cases where internal >

Re: [R-pkg-devel] Best practices for vignettes

2015-07-27 Thread Henrik Bengtsson
Have a look at tools::buildVignette() - it builds a vignette the same way as R CMD build does it. It's a good start for troubleshooting. /Henrik On Mon, Jul 27, 2015 at 1:31 AM, Lenth, Russell V russell-le...@uiowa.edu wrote: Thanks, Dirk. Well, I tried this (after suitable modification), and

Re: [R-pkg-devel] R-devel problem with temporary files or decompression?

2015-07-12 Thread Henrik Bengtsson
I don't see any particular wrong with your code, so it seems like R.utils doesn't handle your 'file' / 'tmp' pathnames correctly. However, I cannot reproduce this (know what 'file' and 'tmp' are would help), so I cannot fix it either. Either way, instead of using low-level decompressFile(), you

[R-pkg-devel] Format/parser for NEWS (not NEWS.Rd)?

2015-10-07 Thread Henrik Bengtsson
Hi, I'm looking for a parser of the plain text NEWS format (not the NEWS.Rd format) - ideally the same on that is used by R itself. Does anyone know which that one is / of such at tool? Thanks, Henrik PS. help("news") mentions tools:::news2Rd(), but that's actually defunct (just reported

Re: [R-pkg-devel] Format/parser for NEWS (not NEWS.Rd)?

2015-10-13 Thread Henrik Bengtsson
iously and put the NEWS file in a separate "sandbox" directory, then you get: > tools:::news2Rd("NEWS", out="NEWS.Rd") Error: 'readNEWS' is defunct. See help("Defunct") With the a very recent R-devel, you now get: > tools:::news2Rd("NEWS", "NEW

Re: [R-pkg-devel] Getting a package ready for CRAN - some questions

2016-06-01 Thread Henrik Bengtsson
If it's not feasible to create a fast vignette or to avoid downloading files, an alternative is to pre-generate the vignette and include it as a static PDF/HTML vignette, cf. https://cran.r-project.org/package=R.rsp. If it's a LaTeX-based vignette (e.g. Sweave/knitr), you could pre-generate the

Re: [R-pkg-devel] Has GitHub been used as a CRAN-style repository?

2016-04-27 Thread Henrik Bengtsson
On Wed, Apr 27, 2016 at 12:40 PM, Ramon Diaz-Uriarte wrote: > Dear Bruce, > > > On Wed, 27-04-2016, at 19:00, Bruce Hoff wrote: >> Following up to my earlier post: It looks like Dirk Eddelbuettel has in >> fact built what I was asking for with 'drat',

Re: [R-pkg-devel] What's recommended to do on "Suggests or Enhances not in mainstream repositories: ..."?

2016-05-21 Thread Henrik Bengtsson
On Sat, May 21, 2016 at 8:22 AM, Marius Hofert wrote: > Hi, > > I have (co-)developed two packages: 'qrmtools' and 'qrmdata'. The > latter contains data sets and is currently only available on R-Forge > (as it is larger than 5MB and thus not accepted for CRAN [although

<    3   4   5   6   7   8   9   10   11   >