pymat: Python-style Formatting of Strings.

Description Usage Arguments Examples

View source: R/pymat.R

Description

This function allows Python-style formatting of strings, whereby text of the form {0}, {1}, ..., {n} is substituted according to the matching argument passed to .... 0 corresponds to the first argument, 1 corresponds to the second, and so on.

Usage

1
pymat(x, ..., collapse = ", ")

Arguments

x

A string with arguments to be replaced in the form of {0}, {1}, ..., {n}.

...

Arguments to be substituted into x.

collapse

If vectors of length greater than 1 are passed to ..., then we collapse the vectors with this separator.

Examples

1
2
3
4
5
6
7
8
9
pymat(
  "My favourite fruits are: {0}, {1}, and {2}.",
  "apple", "banana", "orange"
)

pymat(
  "My favourite fruits are: {0}.",
  c("apple", "banana", "orange"), collapse=", "
)

Kmisc documentation built on May 29, 2017, 1:43 p.m.

Related to pymat in Kmisc...