Dynamic String Formatting

Pass named and unnamed character vectors into specified positions in strings. This represents an attempt to replicate some of python's string formatting.


stringformattr

Dynamic String Formatting

This is a simple set of functions that attempt to emulate python-like string formatting. For example, in python, one can do the following:

'the quick brown fox jump' + 'ed over the lazy dog'
# > 'the quick brown fox jumped over the lazy dog'

'SELECT {column} FROM {table}'.format(column = 'STUDENT_ID', table = 'STUDENTS')
# > 'SELECT STUDENT_ID FROM STUDENTS'

With this package, the same operations are available in R:

'the quick brown fox jump' %p% 'ed over the lazy dog'

'SELECT {column} FROM {table}' %f% c(column = 'STUDENT_ID', table = 'STUDENTS')

Available on CRAN here.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("stringformattr")

0.1.2 by Alexander Hoyle, 9 years ago


Browse source code at https://github.com/cran/stringformattr


Authors: Alexander Hoyle


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports stringr


See at CRAN