What about these packages in CRAN database

Hi,

on Tuesday, 18 february 2025, this R chunk (depending on the CRAN packages database content) :

library(dplyr)
library(gt)

pdb <- tools::CRAN_package_db() 
pdb |> 
    group_by(Package, Version) |> 
    summarize(n = n(), .groups = "drop") |> 
    filter(n > 1) |> 
    inner_join(pdb, by = join_by(Package, Version)) |> 
    select(Package, Version, Depends, `Date/Publication`) |> 
    arrange(tolower(Package), Version, Depends) |>
    gt()

gives me this result :

Package Version Depends Date/Publication
boot 1.3-31 R (>= 3.0.0), graphics, stats 2024-08-28 13:20:02 UTC
boot 1.3-31 R (>= 4.4), graphics, stats 2024-08-28 13:20:02 UTC
boot 1.3-31 R (>= 4.5), graphics, stats 2024-08-28 13:20:02 UTC
class 7.3-23 R (>= 3.0.0), stats, utils 2025-01-01 10:25:33 UTC
class 7.3-23 R (>= 4.4), stats, utils 2025-01-01 10:25:33 UTC
class 7.3-23 R (>= 4.5), stats, utils 2025-01-01 10:25:33 UTC
cluster 2.1.8 R (>= 3.5.0) 2024-12-11 17:40:01 UTC
cluster 2.1.8 R (>= 4.4) 2024-12-11 17:40:01 UTC
cluster 2.1.8 R (>= 4.5) 2024-12-11 17:40:01 UTC
codetools 0.2-20 R (>= 2.1) 2024-03-31 20:10:06 UTC
codetools 0.2-20 R (>= 4.4) 2024-03-31 20:10:06 UTC
codetools 0.2-20 R (>= 4.5) 2024-03-31 20:10:06 UTC
foreign 0.8-88 R (>= 4.0.0) 2025-01-12 12:43:51 UTC
foreign 0.8-88 R (>= 4.4) 2025-01-12 12:43:51 UTC
foreign 0.8-88 R (>= 4.5) 2025-01-12 12:43:51 UTC
KernSmooth 2.23-26 R (>= 2.5.0), stats 2025-01-01 10:25:36 UTC
KernSmooth 2.23-26 R (>= 4.4), stats 2025-01-01 10:25:36 UTC
KernSmooth 2.23-26 R (>= 4.5), stats 2025-01-01 10:25:36 UTC
lattice 0.22-6 R (>= 4.0.0) 2024-03-20 06:10:02 UTC
lattice 0.22-6 R (>= 4.4) 2024-03-20 06:10:02 UTC
lattice 0.22-6 R (>= 4.5) 2024-03-20 06:10:02 UTC
MASS 7.3-64 R (>= 4.4), grDevices, graphics, stats, utils 2025-01-04 17:32:27 UTC
MASS 7.3-64 R (>= 4.4.0), grDevices, graphics, stats, utils 2025-01-04 17:32:27 UTC
MASS 7.3-64 R (>= 4.5), grDevices, graphics, stats, utils 2025-01-04 17:32:27 UTC
Matrix 1.7-2 R (>= 4.4), methods 2025-01-23 16:40:11 UTC
Matrix 1.7-2 R (>= 4.4), methods 2025-01-23 16:40:11 UTC
Matrix 1.7-2 R (>= 4.5), methods 2025-01-23 16:40:11 UTC
mgcv 1.9-1 R (>= 3.6.0), nlme (>= 3.1-64) 2023-12-21 00:30:02 UTC
mgcv 1.9-1 R (>= 4.4), nlme (>= 3.1-64) 2023-12-21 00:30:02 UTC
mgcv 1.9-1 R (>= 4.5), nlme (>= 3.1-64) 2023-12-21 00:30:02 UTC
nlme 3.1-167 R (>= 3.6.0) 2025-01-27 16:04:27 UTC
nlme 3.1-167 R (>= 4.4) 2025-01-27 16:04:27 UTC
nlme 3.1-167 R (>= 4.5) 2025-01-27 16:04:27 UTC
nnet 7.3-20 R (>= 3.0.0), stats, utils 2025-01-01 10:25:43 UTC
nnet 7.3-20 R (>= 4.4), stats, utils 2025-01-01 10:25:43 UTC
nnet 7.3-20 R (>= 4.5), stats, utils 2025-01-01 10:25:43 UTC
rpart 4.1.24 R (>= 2.15.0), graphics, stats, grDevices 2025-01-07 07:30:14 UTC
rpart 4.1.24 R (>= 4.4), graphics, stats, grDevices 2025-01-07 07:30:14 UTC
rpart 4.1.24 R (>= 4.5), graphics, stats, grDevices 2025-01-07 07:30:14 UTC
spatial 7.3-18 R (>= 3.0.0), graphics, stats, utils 2025-01-01 10:25:46 UTC
spatial 7.3-18 R (>= 4.4), graphics, stats, utils 2025-01-01 10:25:46 UTC
spatial 7.3-18 R (>= 4.5), graphics, stats, utils 2025-01-01 10:25:46 UTC
survival 3.8-3 R (>= 3.5.0) 2024-12-17 20:20:02 UTC
survival 3.8-3 R (>= 4.4) 2024-12-17 20:20:02 UTC
survival 3.8-3 R (>= 4.5) 2024-12-17 20:20:02 UTC

Can someone explain me :

  • why these packages are special and
  • why the redundancy ?

Thanks a lot for explanations.

Alain

Many people do not trust clicking on PDF files online, for good reasons. Can you include the output in your post, a text?

Based on your code, your question is about having multiple versions of the same package in the metadata. This is perfectly legal, and CRAN usually do it to serve updates to recommended packages. These packages usually come with R, but they can be updated independently of updating R. By supplying multiple versions, the installer client (install.packages(), usually) can select the one that is appropriate for the user's R version.

  • Thanks for answering to my first point Gabor.

  • You're definitely right for PDF links.
    I modified result data with raw text instead of my PDF link.

  • About my 2^{nd} point, I don't understand why Matrix package metadata contains two identical contents for Package, Version and Depends columns.

Package Version Depends Date/Publication
Matrix 1.7-2 R (>= 4.4), methods 2025-01-23 16:40:11 UTC
Matrix 1.7-2 R (>= 4.4), methods 2025-01-23 16:40:11 UTC
Matrix 1.7-2 R (>= 4.5), methods 2025-01-23 16:40:11 UTC

If I look for differences in columns between the two rows


# keep the 2 rows of interest
df <- pdb 
    |> filter(Package == "Matrix" & Depends == "R (>= 4.4), methods")

# get the differences in columns between the 2 rows
get_unequal_column_content <- function(df, row1 = 1, row2 = 2) {

    has_same_column_values <- colnames(df) |> 
        purrr::map(\(x) identical(df[row1, x], df[row2, x])) |> 
        unlist()

    return(colnames(df)[!has_same_column_values])
}
  
get_unequal_column_content(df)

I get :

[1] "Author" "Authors@R" "Description" "Path"

But I don't understand why it matters in the metadata if we have same Package, Version and Depends contents.

Regards.

Alain

I don't know for sure, but possibly they make a copy of all recommended packages, kind of like making a snapshot. The packages are identical at the time of the snapshot, but potentially change in the future.

E.g. for Matrix there are copies in these directories:

  • the package at the regular place for R (>= 4.4),
  • Path: 4.4.3/Recommended for R (>= 4.4),
  • Path: 4.5.0/Recommended for R (>= 4.5).

I agree Matrix is a bit weird because it does not support R < 4.4.x any more. A more common example is boot which has

  • the package at the regular place for R (>= 3.0.0),
  • Path: 4.4.3/Recommended for R (>= 4.4),
  • Path: 4.5.0/Recommended for R (>= 4.5).

install.packages() or alternative installers like pak select the right package based on the R version of the user and the version of boot.

Btw. there is a chance that even for boot the three packages are the same, code-wise, because there version numbers match. But they could be potentially different.

Thanks a lot for explanations Gabor ! :wink:
Anyway, can I find these specific informations elsewhere in a documentation ?

Regards.

Alain

The way install.packages() selects packages is in its manual page, I think. I don't know if the rest is documented anywhere.