Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Official way to get archived packages #8

Open
jeroen opened this issue Apr 23, 2024 · 1 comment
Open

Official way to get archived packages #8

jeroen opened this issue Apr 23, 2024 · 1 comment

Comments

@jeroen
Copy link

jeroen commented Apr 23, 2024

CRAN stores archived packages with date in PACKAGES.in

cran_archived_db <- function(){
  con <- url("https://cran.r-project.org/src/contrib/PACKAGES.in")
  on.exit(close(con))
  db <- as.data.frame(read.dcf(con))
  comments <- db[['X-CRAN-Comment']]
  pattern <- "(Removed|Archived) on ([0-9-]+)"
  m <- regexec(pattern, comments)
  db$Date <- as.Date(vapply(regmatches(comments, m), function(x){
    x[3]
  }, character(1)))
  db <- db[!is.na(db$Package)  & !is.na(db$Date) & db$Date >= '2022-01-01',]
  db$Reason <- gsub("\\s", " ", trimws(sub(" as|for", "", sub(pattern, '', db[['X-CRAN-Comment']]))))
  db[order(db$Package),c("Package", "Date", "Reason")]
}
@HenrikBengtsson
Copy link
Contributor

Thanks. Yes, we should probably track the source directly, especially since we parse that PACKAGES.in file for the dashboard. I started out using CRANberries, because it already tracked it. We probably have to track it ourselves and diff it to get at what hour/minute an event takes place. We've also observed at least one case where they had a typo in the date; something like 21 instead of 12. That typo was fixed some day later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants