R Under development (unstable) (2024-10-31 r87283 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: ll()...") TESTING: ll()... > > 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.27.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 > > ## Create some objects in the current environment > a <- 1:100 > env <- new.env() > env$b <- letters[1:10] > > ## List the content of evironments > x <- ll(envir=env) > print(x) member data.class dimension objectSize 1 b character 10 736 > > ## Empty environment > x <- ll(envir=new.env()) > print(x) data frame with 0 columns and 0 rows > > ## search() path environment > x <- ll(envir=1L) > str(x) 'data.frame': 3 obs. of 4 variables: $ member : chr "a" "env" "x" $ data.class: chr "numeric" "environment" "data.frame" $ dimension : chr "100" "1" "c(0,0)" $ objectSize: num 448 736 600 > > ## search() path environment > x <- ll(envir="R.oo") > str(x) 'data.frame': 331 obs. of 4 variables: $ member : chr "$.BasicObject" "$.Class" "$.Object" "$<-.BasicObject" ... $ data.class: chr "function" "function" "function" "function" ... $ dimension : chr "NULL" "NULL" "NULL" "NULL" ... $ objectSize: num 159200 5624 9528 138472 82848 ... > > ## Filter by name pattern > x <- ll(envir="R.oo", pattern="^throw.*") > print(x) member data.class dimension objectSize 1 throw function NULL 1240 2 throw.Exception function NULL 19640 3 throw.default function NULL 3408 4 throw.error function NULL 4704 > > x <- ll(envir="R.oo", pattern="^NonExistingName$") > print(x) data frame with 0 columns and 0 rows > > ## List all functions and sort them by size > x <- ll(envir="R.oo", mode="function", sortBy="objectSize") > str(x) 'data.frame': 318 obs. of 4 variables: $ member : chr "Object" "BasicObject" "Class" "Exception" ... $ data.class: chr "Class" "Class" "Class" "Class" ... $ dimension : chr "NULL" "NULL" "NULL" "NULL" ... $ objectSize: num 56 384 384 384 384 ... > > ## List all functions of a package and sort them by size > x <- ll(R.oo, mode="function", sortBy="objectSize") > str(x) 'data.frame': 318 obs. of 4 variables: $ member : chr "Object" "BasicObject" "Class" "Exception" ... $ data.class: chr "Class" "Class" "Class" "Class" ... $ dimension : chr "NULL" "NULL" "NULL" "NULL" ... $ objectSize: num 56 384 384 384 384 ... > > ## List all functions of an Object > obj <- Object() > obj$a <- 1:100 > obj$b <- new.env() > x <- ll(obj) > print(x) member data.class dimension objectSize 1 a numeric 100 448 2 b environment 0 0 > > message("TESTING: ll()...DONE") TESTING: ll()...DONE > > proc.time() user system elapsed 0.46 0.10 0.56