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. > source("incl/start.R") 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.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 R.filesets v2.15.1 successfully loaded. See ?R.filesets for help. Attaching package: 'R.filesets' The following objects are masked from 'package:base': append, readLines > > message("*** fullname and friends") *** fullname and friends > > name <- "Name" > tags <- c("tag1", "tag2", "tag3") > fullname <- paste(c(name, tags), collapse=",") > > > message("- fullname()") - fullname() > fn <- fullname(fullname) > print(fn) [1] "Name,tag1,tag2,tag3" > stopifnot(fn == fullname) > > fn <- fullname(name, tags=tags) > print(fn) [1] "Name,tag1,tag2,tag3" > stopifnot(fn == fullname) > > fn <- fullname(name, tags=NULL, tags) > print(fn) [1] "Name,tag1,tag2,tag3" > stopifnot(fn == fullname) > > fn <- fullname(c(name, tags)) > print(fn) [1] "Name,tag1,tag2,tag3" > stopifnot(fn == fullname) > > parts <- fullname(name, tags=tags, collapse=FALSE) > print(parts) [1] "Name" "tag1" "tag2" "tag3" > stopifnot(all(parts == c(name, tags))) > > parts <- fullname(fullname, collapse=FALSE) > print(parts) [1] "Name" "tag1" "tag2" "tag3" > stopifnot(all(parts == c(name, tags))) > > ## Argument 'name' is missing > res <- try(fullname(tags=c(name, tags)), silent=TRUE) > stopifnot(inherits(res, "try-error")) > > > message("- name()") - name() > n <- name(fullname) > print(n) [1] "Name" > stopifnot(n == name) > > n <- name(parts) > print(n) [1] "Name" > stopifnot(n == name) > > n <- name(name, tags) > print(n) [1] "Name" > stopifnot(n == name) > > n <- name(paste(c(name, tags[-1]), collapse=",")) > print(n) [1] "Name" > stopifnot(n == name) > > > message("- tags()") - tags() > ts <- tags(fullname) > print(ts) [1] "tag1" "tag2" "tag3" > stopifnot(all(ts == tags)) > > ts <- tags(fullname, collapse=TRUE) > print(ts) [1] "tag1,tag2,tag3" > stopifnot(all(ts == paste(tags, collapse=","))) > > ts <- tags(parts) > print(ts) [1] "tag1" "tag2" "tag3" > stopifnot(all(ts == tags)) > > ts <- tags(name, tags) > print(ts) [1] "tag1" "tag2" "tag3" > stopifnot(all(ts == tags)) > > ts <- tags(paste(c(name, tags[-1]), collapse=",")) > print(ts) [1] "tag2" "tag3" > stopifnot(all(ts == tags[-1])) > > > message("- dropTags()") - dropTags() > fn <- dropTags(fullname) > print(fn) [1] "Name" "tag1" "tag2" "tag3" > stopifnot(all(fn == parts)) > > fn <- dropTags(parts) > print(fn) [1] "Name" "tag1" "tag2" "tag3" > stopifnot(all(fn == parts)) > > fn <- dropTags(name, tags) > print(fn) [1] "Name" "tag1" "tag2" "tag3" > stopifnot(all(fn == parts)) > > fn <- dropTags(paste(c(name, tags[-1]), collapse=",")) > print(fn) [1] "Name" "tag2" "tag3" > stopifnot(all(fn == c(name, tags[-1]))) > > fn <- dropTags(fullname, drop=NULL) > print(fn) [1] "Name" "tag1" "tag2" "tag3" > stopifnot(all(fn == parts)) > > fn <- dropTags(fullname, drop="foo") > print(fn) [1] "Name" "tag1" "tag2" "tag3" > stopifnot(all(fn == parts)) > > fn <- dropTags(fullname, drop=tags) > print(fn) [1] "Name" > stopifnot(all(fn == parts[1])) > > fn <- dropTags(fullname, drop=tags[1]) > print(fn) [1] "Name" "tag2" "tag3" > stopifnot(all(fn == parts[-2])) > > fn <- dropTags(fullname, drop=name) > print(fn) [1] "Name" "tag1" "tag2" "tag3" > stopifnot(all(fn == parts)) > > > message("- Arguments$getTags()") - Arguments$getTags() > library("R.utils") R.utils v2.12.3 (2023-11-18 01:00:02 UTC) successfully loaded. See ?R.utils for help. Attaching package: 'R.utils' The following objects are masked _by_ '.GlobalEnv': mstr, printf The following object is masked from 'package:R.filesets': validate The following object is masked from 'package:utils': timestamp The following objects are masked from 'package:base': cat, commandArgs, getOption, isOpen, nullfile, parse, use, warnings > ts <- Arguments$getTags(NULL) > stopifnot(length(ts) == 0, is.null(ts)) > > ts <- Arguments$getTags(character(0L)) > stopifnot(length(ts) == 0, is.null(ts)) > > ts <- Arguments$getTags(NA_character_) > stopifnot(length(ts) == 0, is.null(ts)) > > ts <- Arguments$getTags(tags) > print(ts) [1] "tag1,tag2,tag3" > stopifnot(all.equal(ts, paste(tags, collapse=","))) > > ts <- Arguments$getTags(tags, collapse=NULL) > print(ts) [1] "tag1" "tag2" "tag3" > stopifnot(all.equal(ts, tags)) > > > message("*** fullname and friends ... DONE") *** fullname and friends ... DONE > > source("incl/end.R") > > proc.time() user system elapsed 0.12 0.12 0.23