psprintf | R Documentation |
Helper function to sprintf a bunch of key-value (string-variableVector) pairs, then paste them together with a good separator for contructing remake recipes.
psprintf(..., sep = "\n ")
... |
arguments that are either (1) character strings to insert directly into the output or (2) named arguments, where the name is an sprintf pattern and the value is a list or vector of variables to apply to that particular sprintf pattern. After any relevant sprint evaluation, all arguments will be pasted, with the specified separator, in order to create a single character output. |
sep |
separator for the list of arguments, defaults to new line |
cat(psprintf(
"plot_frame(",
"png_file = target_name,",
"date = date_%s," = "2018-01-23",
"state = %s)" = "Wisconsin"))
##plot_frame(
## png_file = target_name,
## date = date_2018-01-23,
## state = Wisconsin)
cat(psprintf(
'cmd(',
'a = %s, b = \'%s\','=c('dog','cat'),
'c = "rat")'
))
## cmd(
## a = dog, b = 'cat',
## c = "rat")
cat(psprintf(
'cmd(',
'a = %s, b = %0.1f,'=list('dog',7),
'c = "rat")'
))
## cmd(
## a = dog, b = 7.0,
## c = "rat")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.