R Under development (unstable) (2024-01-23 r85822 ucrt) -- "Unsuffered Consequences" 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. > message("TESTING: Package...") TESTING: Package... > > library("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.26.0 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 > > # By defining .onAttach() as follows in zzz.R for a package, an > # instance of class Package with the same name as the package will > # be made available on the search path. More over, the code below > # will also inform the user that the package has been loaded: > # > # > library(R.oo) > # R.oo v0.52 (2003/04/13) was successfully loaded. > # > .onAttach <- function(libname, pkgname) { + pkg <- Package(pkgname) + assign(pkgname, pkg, pos=getPosition(pkg)) + cat(getName(pkg), " v", getVersion(pkg), " (", getDate(pkg), ")", + " was successfully loaded.\n", sep="") + } > > # The Package class works for any packages, loaded or not. > > # Some information about the base package > pkg <- Package("base") > print(pkg) [1] "Package: base v4.4.0 is loaded (pos=11). Title: The R Base Package. The official webpage is NA and the maintainer is R Core Team . The package is installed in D:/RCompile/recent/R/library/base. License: Part of R 4.4.0. Description: Base R functions. Type showNews(base) for package history, and ?base for help." > # [1] "Package: base v3.6.2 is loaded (pos=14). Title: The R Base Package. > # The official webpage is NA and the maintainer is R Core Team # r-project.org>. The package is installed in /usr/lib/R/library/base/. > # License: Part of R 3.6.2. Description: Base R functions. Type > # showNews(base) for package history, and ?base for help." > print(list.files(Package("base")$dataPath)) character(0) > > # Some information about the R.oo package > print(R.oo::R.oo) [1] "Package: R.oo v1.26.0 is loaded (pos=2). Title: R Object-Oriented Programming with or without References. The official webpage is https://github.com/HenrikBengtsson/R.oo and the maintainer is Henrik Bengtsson. The package is installed in D:/RCompile/CRANincoming/R-devel/lib/R.oo. License: LGPL (>= 2.1). Description: Methods and classes for object-oriented programming in R with or without references. Large effort has been made on making definition of methods as simple as possible with a minimum of maintenance for package developers. The package has been developed since 2001 and is now considered very stable. This is a cross-platform package implemented in pure R that defines standard S3 classes without any tricks. Type showNews(R.oo) for package history, and ?R.oo for help." > # [1] "Package: R.oo v1.23.0-9000 . Title: R Object-Oriented Programming > # with or without References. The official webpage is https://github.com/ > # HenrikBengtsson/R.oo and the maintainer is Henrik Bengtsson. The package > # is installed in /home/alice/R/x86_64-pc-linux-gnu-library/3.6/R.oo/. > # License: LGPL (>= 2.1). Description: Methods and classes for object- > # oriented programming in R with or without references. Large effort has > # been made on making definition of methods as simple as possible with a > # minimum of maintenance for package developers. The package has been > # developed since 2001 and is now considered very stable. This is a > # cross-platform package implemented in pure R that defines standard S3 > # classes without any tricks. Type showNews(R.oo) for package history, > # and ?R.oo for help." > > pkg <- Package("R.oo") > classes <- getClasses(pkg) > print(classes) [1] "BasicObject" "Class" "Exception" [4] "Interface" "InternalErrorException" "Object" [7] "Package" "RccViolationException" "Rdoc" [10] "RdocException" > stopifnot(all(c("Object", "Class", "Interface", "Exception", "Package") %in% classes)) > > pkg <- Package("R.oo") > res <- showDescriptionFile(pkg, pager=function(...) TRUE) > stopifnot(isTRUE(res)) > res <- showNews(pkg, pager=function(...) TRUE) > stopifnot(isTRUE(res)) > res <- showChangeLog(pkg, pager=function(...) TRUE) > stopifnot(isTRUE(res)) > res <- showHistory(pkg, pager=function(...) TRUE) > stopifnot(isTRUE(res)) > > > res <- try(Package("Non-Existing-Package"), silent=TRUE) > stopifnot(inherits(res, "try-error")) > > message("TESTING: Package...DONE") TESTING: Package...DONE > > proc.time() user system elapsed 0.35 0.12 0.42