Description Usage Arguments Details Examples
printf()
is reminiscent of python's f-strings, where prefacing a string with f
enables the user to evaluate code within braces before printing to the console. This functionality already exists in the glue package; so this is wrapper around that. However, what it also brings is an additional wrapper around the crayon package at the same time. You can therefore colour and evaluate print statements easily.
1 | printf(string)
|
string |
String to format. |
In short, use $$
to signal a call to the crayon library. Calls can be nested with further single $
symbols. Close the call with $$x
(Optional for the final closing brace).
1 2 3 4 5 6 7 8 9 10 11 | var1 <- 1
var2 <- 2
var3 <- "world"
var4 <- "this example"
printf("{var1} added to {var2} equals {var1 + var2}")
printf("Hello $$strikethrough mum $$x world!")
printf("$$blue this example shows that `printf()` will auto close final braces")
printf("This example shows that you can $$cyan$bold combine $$x formating")
printf("$$magenta$italic {var4} $$x $$green$underline brings it $$x $$blurred all together")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.