cati {gsubfn}R Documentation

cat with string interpolation

Description

Similar to "cat" except that the strings can include "gsubfn"-like string interpolation.

Usage

cati(..., file = "", sep = " ", fill = FALSE, labels = NULL, append = FALSE, env = parent.frame(), pattern = "[$]([[:alpha:]][[:alnum:].]*)|`([^`]+)`", backref = nchar(base::gsub("[^(]", "", pattern)), end = "")
cati0(..., sep = "")

cat0(..., sep = "")
paste0(..., sep = "")

Arguments

... R objects which are coerced to character strings, concatenated, and printed, with the remaining arguments controlling the output.
file A connection, or a character string naming the file to print to. If '""' (the default), "cat" prints to the standard output connection, the console unless redirected by "'sink'".
sep character string to insert between the objects to print.
fill a logical or numeric controlling how the output is broken into successive lines. If "FALSE" (default), only newlines created explicitly by "\n" are printed. Otherwise, the output is broken into lines with print width equal to the option 'width' if 'fill' is 'TRUE', or the value of 'fill' if this is numeric.
labels character vector of labels for the lines printed. Ignored if 'fill' is 'FALSE'.
append logical. Only used if the argument "file" is the name of file (and not a connection or '"|cmd"'). If "TRUE" output will be appended to "file"; otherwise, it will overwrite the contents of "file".
env Same as in "gsubfn". Normally not used.
pattern Same as in "gsubfn". Normally not used.
backref Same as in "gsubfn". Normally not used.
end String to be appended to the output string. "sep" is not used to separate "end".

Details

"cati" is similar to "cat" except that "gsub"-style string interpolcation can be used in the arguments.

"cat0", "cati0" and "paste0" are similar to the corresponding functions without the "0" except that the default value for "sep" is the empty string.

Value

None (invisible 'NULL').

See Also

Also see gsubfn.

Examples

cati("pi = $pi, pi rounded = `round(pi,2)`\n")

# no comma after 3 as newline specified via end=
cati(1, 2, 3, sep = ",", end = "\n")

[Package gsubfn version 0.1-4 Index]