>>>>> Gábor Csárdi 
>>>>>     on Wed, 4 Feb 2026 12:19:56 +0100 writes:

    > Since car was released not so long ago, I am fairly sure that this is
    > an issue with the CRAN metadata, similar to what I (and many others)
    > see for newly released packages:
    > https://stat.ethz.ch/pipermail/r-sig-mac/2026-February/015335.html

    > I wrote some code to show the packages for which the metadata is 
inconsistent:
    > https://gist.github.com/gaborcsardi/797472e42b43d2f938f852614f2a170f
    > (Update the URL for a different arch or R version.)
    > Seems like car should be fine now, assuming this already propagated to
    > your mirror.

    > FWIW AFAIR all RStudio does is calling install.packages() so if you
    > see a 404 there, it is unlikely that it is a problem with RStudio.

Well, for many years now, still in my 2026 version of RStudio,
they (now "Posit") put  **their own** version of install.packages in the user's 
search() path;
they do it "smartly" and set it's environment still to
asNamespace("utils") such that printing it looks normal at first
(and also in order for the function to see internal utils
functionality which should ...):

If you type `install.packages` (*without* '(..)') to print its definition to 
the console, 
in the R console in Rstudio, Menu [Help] --> [About RStudio]
showing popup menu

      RStudio
      2026.01.0 Build 392
      © 2009-2026 Posit Software, PBC

with small print (in two lines; the mail software will wrap the
relatively long lines), hence I'm adding a line '-----------------' 
between the two) :

-----------------
RStudio 2026.01.0+392 "Apple Blossom" Release 
(49fbea7a09a468fc4d1993ca376fd5b971cb58e3, 2026-01-04) for RHEL 9
-----------------
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) 
rstudio/2026.01.0+392 Chrome/140.0.7339.249 Electron/38.7.2 Safari/537.36, 
Quarto 1.6.42 (/opt/quarto-1.6.42/bin/quarto)
-----------------

I see

> install.packages
function (pkgs, lib, repos = getOption("repos"), contriburl = 
contrib.url(repos, 
    type), method, available = NULL, destdir = NULL, dependencies = NA, 
    type = getOption("pkgType"), configure.args = getOption("configure.args"), 
    configure.vars = getOption("configure.vars"), clean = FALSE, 
    Ncpus = getOption("Ncpus", 1L), verbose = getOption("verbose"), 
    libs_only = FALSE, INSTALL_opts, quiet = FALSE, keep_outputs = FALSE, 
    ...) 
{
    ""
    "This is an RStudio hook."
    "Use `utils::install.packages()` to bypass this hook if necessary."
    ""
    if (interactive()) {
        canInstallPackages <- .Call("rs_canInstallPackages", 
            PACKAGE = "(embedding)")
        if (!canInstallPackages) {
            msg <- "Package installation is disabled in this version of 
RStudio."
            stop(msg, call. = FALSE)
        }
        if (.rs.installPackagesRequiresRestart(pkgs)) {
            response <- .rs.askForRestart("install.packages")
            if (identical(response, TRUE)) {
                call <- do.call(substitute, list(match.call(), 
                  parent.frame()))
                call[[1L]] <- quote(install.packages)
                names(call)[[2L]] <- ""
                command <- paste(.rs.deparseCall(call), collapse = " ")
                .rs.enqueLoadedPackageUpdates(command)
                invokeRestart("abort")
            }
            else if (identical(response, FALSE)) {
            }
            else {
                invokeRestart("abort")
            }
        }
        .rs.addRToolsToPath()
        on.exit(.rs.restorePreviousPath(), add = TRUE)
    }
    if (missing(lib) || is.null(lib)) 
        lib <- .libPaths()[1L]
    isLocal <- is.null(repos) || any(grepl("/", pkgs, fixed = TRUE))
    if (isLocal) {
        call <- sys.call()
        call[[1L]] <- quote(utils::install.packages)
        result <- eval(call, envir = parent.frame())
        shouldRecord <- is.character(pkgs) && length(pkgs) == 
            1L
        if (shouldRecord) {
            pkgDesc <- tryCatch(.rs.readPackageDescription(pkgs), 
                error = function(cnd) NULL)
            if (length(pkgDesc)) {
                pkgPath <- file.path(lib, pkgDesc[["Package"]])
                if (file.exists(pkgPath)) {
                  tryCatch(.rs.recordPackageSource(pkgPath, pkgs), 
                    error = .rs.logWarningMessage)
                }
            }
        }
    }
    else {
        before <- .rs.installedPackagesFileInfo(lib)
        call <- sys.call()
        call[[1L]] <- quote(utils::install.packages)
        result <- eval(call, envir = parent.frame())
        after <- .rs.installedPackagesFileInfo(lib)
        rows <- .rs.installedPackagesFileInfoDiff(before, after)
        .rs.recordPackageSource(rows$path)
    }
    if (interactive()) {
        .rs.updatePackageEvents()
        .Call("rs_packageLibraryMutated", PACKAGE = "(embedding)")
    }
    invisible(result)
}
<environment: namespace:utils>
>
------------------------------

If you instead look at  utils::install.packages
you see that it has a completely different body, but identical
arguments,
also in RStudio's function they construct a call to utils::install.packages,
i.e., in principle it *is* "just" a wrapper about R's function;
but I have seen several (somewhat special) cases, where the
result of the two different functions *was* different.



    > Nevertheless I agree that it is always a good idea to test your code
    > in a plain R console.

and now, not "nevertheless",  but really because you get the
true install.packages() function from utils, rather than RStudio / Posit's 
version
which does its own things in addition to what the
utils::install.packages function would do.

Martin

_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to