- String process
Function paste()
, nchar()
,
strsplit()
, substr()
, match()
, ...
```
a <- paste("string", 9:1, ".txt", sep = "")
nchar(a)
strsplit(a, "\\.")
substr(a, 1, 6) <- "Substr"; a
match("Substr9.txt", a)
```
- Regulas expression
Function grep()
, gsub()
, ...
```
a <- paste("string", 9:1, ".txt", sep = "")
grep("([1,3,5-7])", a)
b <- paste("string", 9:1, ".txt", sep = "", collapse = " ")
gsub("([1,3,5-7]).(txt)", "_\\1-\\2", b)
```
- Expression and Parse
Function expression()
, parse()
, ...
These are important functions for computing in text and
useful for processing automatically jobs as shown in
"Batch More".
```
a <- 0.05
expression(alpha == 0.05)
(ret <- parse(text = paste("alpha == ", a, sep = "")))
plot(1, 1, main = ret)
text(1, 1.2, ret)
```
---