R Under development (unstable) (2023-11-16 r85542 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 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. > library("R.utils") Loading required package: R.oo Loading required package: R.methodsS3 R.methodsS3 v1.8.2 (2022-06-13 22:00:14 UTC) successfully loaded. See ?R.methodsS3 for help. R.oo v1.25.0 (2022-06-12 02:20:02 UTC) successfully loaded. See ?R.oo for help. Attaching package: 'R.oo' The following object is masked from 'package:R.methodsS3': throw The following objects are masked from 'package:methods': getClasses, getMethods The following objects are masked from 'package:base': attach, detach, load, save R.utils v2.12.3 successfully loaded. See ?R.utils for help. Attaching package: 'R.utils' The following object is masked from 'package:utils': timestamp The following objects are masked from 'package:base': cat, commandArgs, getOption, isOpen, nullfile, parse, warnings > > # Set new default repositories for this test > orepos <- options(repos=c( + CRAN="http://cran.r-project.org", + EXAMPLE="http://example.org" + )) > > message("Current repositories:") Current repositories: > str(as.list(getOption("repos"))) List of 2 $ CRAN : chr "http://cran.r-project.org" $ EXAMPLE: chr "http://example.org" > > message("All current repositories:") All current repositories: > withRepos({ + str(as.list(getOption("repos"))) + }) List of 5 $ CRAN : chr "http://cran.r-project.org" $ CRANextra: chr "https://www.stats.ox.ac.uk/pub/RWin" $ BioCsoft : chr "https://bioconductor.org/packages/3.18/bioc" $ BioCann : chr "https://bioconductor.org/packages/3.18/data/annotation" $ BioCexp : chr "https://bioconductor.org/packages/3.18/data/experiment" > > message("All current repositories (explicit):") All current repositories (explicit): > withRepos({ + str(as.list(getOption("repos"))) + }, repos="[[current]]") List of 2 $ CRAN : chr "http://cran.r-project.org" $ EXAMPLE: chr "http://example.org" > > message("CRAN (only):") CRAN (only): > withRepos({ + str(as.list(getOption("repos"))) + }, repos="CRAN") List of 1 $ CRAN: chr "http://cran.r-project.org" > > > message("braju.com (only):") braju.com (only): > withRepos({ + str(as.list(getOption("repos"))) + }, repos="braju.com") List of 1 $ braju.com: chr "https://braju.com/R" > > message("CRAN and braju.com (only):") CRAN and braju.com (only): > withRepos({ + str(as.list(getOption("repos"))) + }, repos=c("CRAN", "braju.com")) List of 2 $ CRAN : chr "http://cran.r-project.org" $ braju.com: chr "https://braju.com/R" > > message("braju.com and CRAN (only):") braju.com and CRAN (only): > withRepos({ + str(as.list(getOption("repos"))) + }, repos=c("braju.com", "CRAN")) List of 2 $ braju.com: chr "https://braju.com/R" $ CRAN : chr "http://cran.r-project.org" > > > message("All CRAN replated repositories (only):") All CRAN replated repositories (only): > withRepos({ + str(as.list(getOption("repos"))) + }, repos="[[CRAN]]") List of 2 $ CRAN : chr "http://cran.r-project.org" $ CRANextra: chr "https://www.stats.ox.ac.uk/pub/RWin" > > message("Mainstream (CRAN and BioC related) repositories (only):") Mainstream (CRAN and BioC related) repositories (only): > withRepos({ + str(as.list(getOption("repos"))) + }, repos="[[mainstream]]") List of 5 $ CRAN : chr "http://cran.r-project.org" $ CRANextra: chr "https://www.stats.ox.ac.uk/pub/RWin" $ BioCsoft : chr "https://bioconductor.org/packages/3.18/bioc" $ BioCann : chr "https://bioconductor.org/packages/3.18/data/annotation" $ BioCexp : chr "https://bioconductor.org/packages/3.18/data/experiment" > > message("braju.com and mainstream (only):") braju.com and mainstream (only): > withRepos({ + str(as.list(getOption("repos"))) + }, repos="[[braju.com]]") List of 6 $ braju.com: chr "https://braju.com/R" $ CRAN : chr "http://cran.r-project.org" $ CRANextra: chr "https://www.stats.ox.ac.uk/pub/RWin" $ BioCsoft : chr "https://bioconductor.org/packages/3.18/bioc" $ BioCann : chr "https://bioconductor.org/packages/3.18/data/annotation" $ BioCexp : chr "https://bioconductor.org/packages/3.18/data/experiment" > > message("R-Forge and mainstream (only):") R-Forge and mainstream (only): > withRepos({ + str(as.list(getOption("repos"))) + }, repos="[[R-Forge]]") List of 6 $ R-Forge : chr "https://R-Forge.R-project.org" $ CRAN : chr "http://cran.r-project.org" $ CRANextra: chr "https://www.stats.ox.ac.uk/pub/RWin" $ BioCsoft : chr "https://bioconductor.org/packages/3.18/bioc" $ BioCann : chr "https://bioconductor.org/packages/3.18/data/annotation" $ BioCexp : chr "https://bioconductor.org/packages/3.18/data/experiment" > > message("An explicit repository URL:") An explicit repository URL: > withRepos({ + str(as.list(getOption("repos"))) + }, repos="http://r-forge.r-project.org") List of 1 $ : chr "http://r-forge.r-project.org" > > message("An explicit repository URL + mainstream:") An explicit repository URL + mainstream: > withRepos({ + str(as.list(getOption("repos"))) + }, repos=c("http://r-forge.r-project.org", "[[mainstream]]")) List of 6 $ : chr "http://r-forge.r-project.org" $ CRAN : chr "http://cran.r-project.org" $ CRANextra: chr "https://www.stats.ox.ac.uk/pub/RWin" $ BioCsoft : chr "https://bioconductor.org/packages/3.18/bioc" $ BioCann : chr "https://bioconductor.org/packages/3.18/data/annotation" $ BioCexp : chr "https://bioconductor.org/packages/3.18/data/experiment" > > message("All known:") All known: > withRepos({ + str(as.list(getOption("repos"))) + }, repos="[[all]]") List of 9 $ CRAN : chr "http://cran.r-project.org" $ BioCsoft : chr "https://bioconductor.org/packages/3.18/bioc" $ BioCann : chr "https://bioconductor.org/packages/3.18/data/annotation" $ BioCexp : chr "https://bioconductor.org/packages/3.18/data/experiment" $ CRANextra : chr "https://www.stats.ox.ac.uk/pub/RWin" $ R-Forge : chr "https://R-Forge.R-project.org" $ rforge.net: chr "https://www.rforge.net" $ braju.com : chr "https://braju.com/R" $ EXAMPLE : chr "http://example.org" > > > > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > # Visibility > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > res <- withVisible({ + withRepos({ 1 }) + }) > str(res) List of 2 $ value : num 1 $ visible: logi TRUE > stopifnot(all.equal(res$value, 1)) > stopifnot(res$visible) > > x <- 0 > res <- withVisible({ + withRepos({ x <- 1 }) + }) > str(res) List of 2 $ value : num 1 $ visible: logi FALSE > stopifnot(all.equal(res$value, 1)) > stopifnot(!res$visible) > stopifnot(all.equal(x, 1)) > > > # Undo > options(orepos) > > proc.time() user system elapsed 0.42 0.03 0.45