There are two kinds of builds: source builds (producing the .tar.gz file) and binary builds (producing the .zip file on Windows). Binary builds are specific to R minor versions: if you build on R version x.y.z, you can't expect the package to work if either x or y changes.

Source builds should work on other R versions, though sometimes moving to earlier versions will cause problems (because the format of files in the .tar.gz file may have changed), or your package relies on features that weren't present earlier. Generally .tar.gz files will work on later versions (though changes in R might break it).

So if you did a binary build on R 4.4.x and tested it on R 4.3.1, it's not at all surprising that it failed. If you did a source build on R 4.4.x and it failed on R 4.3.1, that's more surprising.

Duncan Murdoch

On 26/10/2023 9:43 a.m., Plamen Mirazchiyski wrote:
Thank you very much for your responses Duncan and Ivan.

I do not call .Internal(crossprod( ... )) directly. I use crossprod()
just once in the entire package, the actual line of code is

unname(obj = crossprod(x = sweep(x = as.matrix(replicated.averages),
MARGIN = 2, mean.replicate.averages, FUN = "-"))*des.scale.fac)

I followed Ivan's advice, built a binary package from source in R 4.3.1
on Windows 10, then tested it on another Windows 10 machine with R
4.3.1. The problem did not occur et all.

If I understand Ivan's email, my package should work on R 4.3.1, but
what about newer versions? I checked some packages that were released
today, e.g. abn, these were built by CRAN "using R Under development
(unstable) (2023-10-24 r85407 ucrt)". Does this mean mine will fail on
the current released version (4.3.1) if built by CRAN. As far as I see
from the R Developer Page (https://developer.r-project.org), there is a
new version (4.3.2) scheduled for October 31, 2023. Should I better wait
until then?

Best,
Plamen

On 10/25/23 21:26, Ivan Krylov wrote:
В Wed, 25 Oct 2023 21:02:00 +0200
Plamen Mirazchiyski <plamen.mirazchiy...@ineri.org> пишет:

Today I was preparing a new version for the RALSA package. I have
built a Windows package using "devtools::check_win_devel()".

The machine has R 4.3.1, the latest official release. After I load the
test RALSA package, R displays a message saying "Package RALSA built
under R version 4.4.0"

Can you use R CMD build to make a .tar.gz source package and then
install that on the Windows 10 machine running R 4.3.1? There is
convenience and a lot of added value in both Win-Builder and devtools,
but it shouldn't be necessary to rely on 96 CRAN packages and an online
service just to build a package.

crossprod(x,y) has indeed been recently changed from
.Internal(crossprod(x, y)) to .Primitive("crossprod"). This makes it
possible for a binary package prepared using R-devel (with a call to
.Primitive('crossprod')) to misbehave on a released version of R (which
does have .Internal(crossprod(...)) but not .Primitive('crossprod')).

Installing from source will avoid this problem. So will building the
binary package using R-4.3.1 to run it on a different machine with
R-4.3.1.





______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to