R Under development (unstable) (2024-11-01 r87285 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. > #' spatstat.utils/tests/tekst.R > > require(spatstat.utils) Loading required package: spatstat.utils > > #' tests of R/utiltext.R > > a <- paren(character(0)) > a <- paren("hello", "") > a <- paren("hello", "{") > > strsplitretain("hello, world") [[1]] [1] "hello," " world" > > truncline(c("Now is the time for all good people", + "to come to the aid of the Party"), + 15) [1] "Now is the [..]" "to come to [..]" > > is.blank(c("a", " ", "b")) [1] FALSE TRUE FALSE > > onetwo <- c("one", "two") > padtowidth(onetwo, 10, "left") [1] "one " "two " > padtowidth(onetwo, 10, "right") [1] " one" " two" > padtowidth(onetwo, 10, "centre") [1] " one " " two " > > splat("Hello world", indent="zzz") zzzHello world > > choptext("Hello\nWorld") [1] "Hello" "World" > exhibitStringList("Letters", letters) Letters a b c d e f g h i j k l m n o p q r s t u v w x y z > exhibitStringList("Letters", letters[1:4]) Letters a, b, c, d > > numalign(42, 1e4) [1] "00042" > singlestring(1:5) [1] "12345" > > x <- c("TRUE", "unknown", "not known") > verbalogic(x, "and") [1] "unknown and not known" > verbalogic(x, "or") [1] "TRUE" > verbalogic(x, "not") [1] "FALSE" "not { unknown }" "not { not known }" > x[1] <- "FALSE" > verbalogic(x, "and") [1] "FALSE" > > sensiblevarname("$@wtf%!", "variablenumberone") [1] "variablenumb" > nzpaste(c("Hello", "", "World")) [1] "Hello" "" "World" > substringcount("v", "vavavoom") [1] 3 > huh <- c("42", "y <- x", "$%^%$") > is.parseable(huh) 42 y <- x $%^%$ TRUE TRUE FALSE > make.parseable(huh) [1] "X42" "y....x" "X....." > paste.expr(expression(y == x)) [1] "y == x" > pasteFormula(y ~ x + z) [1] "y ~ x + z" > gsubdot("cbind(est,theo)", ". ~ r") [1] "cbind(est,theo) ~ r" > > simplenumber(0) [1] "0" > simplenumber(1/3) [1] "1/3" > simplenumber(2/3) [1] "2/3" > simplenumber(-2) [1] "-2" > simplenumber(0, unit="km") [1] "0" > simplenumber(1/3, unit="km") [1] "km/3" > simplenumber(2/3, unit="km") [1] "2*km/3" > simplenumber(-2, unit="km") [1] "-2*km" > > makeCutLabels(0:3) [1] "(0,1]" "(1,2]" "(2,3]" > > proc.time() user system elapsed 0.23 0.04 0.26