Description Usage Arguments Value See Also Examples
demo_code
objects are evaluated R code, returned from evaluate::evaluate
, with an attached attribute called print_string
which sets up fancy formatting for knitting.
1 |
.code_string |
A string containing executable R code OR a valid expression that will be converted to a string via |
eval |
A boolean specifying whether the code should be immediately evaluated, in addition to creating the |
A demo_code
object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # When run in console, this will print only the results of mean(1:10)
my_dc <- demo_code('mean(1:10)') %>% hlt_funs()
# The demo_code object itself has no output
my_dc
# However, when knitted, the source code is formatted.
attr(my_dc, "print_string")
# Objects defined in demo_code are created in the environment
demo_code('foo <- mean(1:10)')
foo + 5
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.