Use C-style String Formatting Commands

Usage

S(x, ...)

Arguments

x
A single string containing "%s".
...
A vector of substitutions equal in length to the number of "%s" in x or of length one (if length one ... will be recycled).

Value

Returns a string with "%s" replaced.

Description

Convenience wrapper for sprintf that allows recycling of ... of length one.

Examples

S("@after_", "the", "the")
[1] "(?<=\\b(the|the)\\s)(\\w+)"
# Recycle S("@after_", "the")
[1] "(?<=\\b(the|the)\\s)(\\w+)"
S("@rm_between", "LEFT", "RIGHT")
[1] "(LEFT)(.*?)(RIGHT)"

See also

sprintf