Nothing
This is a minimal example of using "polyglot"" knitr to produce an HTML page from Markdown.
knitr::opts_chunk$set(engine.opts = list( perl = "-Mstrict -Mwarnings -Mfeature=say", bash = "-o errexit -o nounset" )) toTest <- c("R", "python", "scala", "bash", "perl") where <- Sys.which(toTest)
for(n in names(where)) { path <- where[n] if(nchar(path) <= 0) { path <- "<not found>" } message("* __", n, "__: `", path, "`\n") }
Pass the string to transform to engine subprocess via environment variable.
Sys.setenv(SOMETHING = "something")
something <- Sys.getenv("SOMETHING") somethingelse <- paste(something, "+ R") cat(paste("'", something, "' is now '", somethingelse, "'", sep=""))
Running small fragments without caching can take some time, as the Scala compiler has to launch and compile the script to JVM bytecode. The -savecompiled
option (passed via engine.opts
) will result in Scala caching the compiled script outside of knitr.
val something = System.getenv("SOMETHING") val somethingelse = something + " + Scala" println("'" + something + "' is now '" + somethingelse + "'")
import os something = os.getenv("SOMETHING") somethingelse = something + " + Python" print("'" + something + "' is now '" + somethingelse + "'")
something=$SOMETHING somethingelse="$something + Bash" echo "'$something' is now '$somethingelse'"
my $something = $ENV{SOMETHING}; $something .= ' + Perl'; say join ' ', qw{something is now}, "'$something'";
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.