R version 4.4.0 beta (2024-04-09 r86391 ucrt) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> repos <- "https://cloud.r-project.org"
>
> # avoid timeout error
> TIMEOUT <- 60
> if(options()$timeout < TIMEOUT) {
+ options(timeout = TIMEOUT)
+ }
>
> try_result <- try({
+ cat("get package list by date\n")
+ pkg_by_date <- dateback:::.get_pkg_by_date(repos)
+ print(head(pkg_by_date))
+ cat("\n")
+
+ cat("get latest package list\n")
+ pkg_latest <- dateback:::.get_pkg_latest(repos)
+ print(head(pkg_latest))
+ cat("\n")
+
+ cat("get archived version list\n")
+ .get_archived_pkgs <- function(repos) {
+ html <- dateback:::.get_html(dateback:::.get_archive_url(repos))
+ rows <- grep(".*?/",
+ strsplit(
+ paste(html, collapse = " "), # some rows may contain \n
+ "")[[1]],
+ value = TRUE)
+ sub(".*(.*?)/.*", "\\1", rows)
+ }
+
+ archived_pkgs <- .get_archived_pkgs(repos)
+ df_archive <- dateback:::.get_df_archive(repos, sample(archived_pkgs, 1))
+ print(head(df_archive))
+ }, silent = TRUE)
get package list by date
Package Date
1 BoneProfileR 2024-04-10
2 epiR 2024-04-10
3 metalite.table1 2024-04-10
4 PACVr 2024-04-10
5 QuantileGH 2024-04-10
6 seededlda 2024-04-10
get latest package list
Package Version Date
1 A3 1.0.0 2015-08-16
2 AATtools 0.0.2 2022-08-12
3 ABACUS 1.0.0 2019-09-20
4 ABC.RAP 0.9.0 2016-10-20
5 ABCanalysis 1.2.1 2017-03-13
6 ABCoptim 0.15.0 2017-11-06
get archived version list
File Date
1 supc_0.1.tar.gz 2017-03-19
2 supc_0.2.0.tar.gz 2018-07-23
3 supc_0.2.1.tar.gz 2018-08-26
4 supc_0.2.2.tar.gz 2019-11-27
5 supc_0.2.3.tar.gz 2021-09-22
6 supc_0.2.4.tar.gz 2021-09-24
>
> if(inherits(try_result, "try-error")) {
+ is_timeout <- grepl("readLines", try_result) &&
+ any(sapply(names(warnings()), function(x) grepl("Timeout", x)))
+
+ if(any(is_timeout)) {
+ cat("Timeout occcured\n")
+ } else {
+ stop(try_result)
+ }
+ }
>
> proc.time()
user system elapsed
3.07 0.20 3.71