Introducing R in JavaScript, a way to insert R code directly into websites, powered by OpenCPU.
You can use it in 2 easy steps.
Add <script src='https://cdn.jsdelivr.net/gh/kdpsingh/rjs/r.js'></script>
anywhere in your HTML file (or download r.js locally).
Add class = "r-code"
to any HTML element.
That's it.
After rjs
runs, the class
will changed to "r-code-output"
. You can run R code dynamically in JavaScript by setting the class of any HTML element to "r-code"
and then calling rjs();
.
- Auto-detect and process both
R
andRmd
formats - Handle special characters in the input
- Render to non-HTML formats such as pdf_document (
rjs
automatically provides a link to the file)