Skip to content

athang/rjs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rjs: R in JavaScript

Introducing R in JavaScript, a way to insert R code directly into websites, powered by OpenCPU.

You can use it in 2 easy steps.

Step 1

Add <script src='https://cdn.jsdelivr.net/gh/kdpsingh/rjs/r.js'></script> anywhere in your html file (or download r.js locally).

Step 2

Add class = "r-code" to any html element containing R or Rmd code.

That's it.

After rjs runs, the class will be 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();.

rjs can:

  • Auto-detect and process both R and Rmd formats
  • Handle special characters in the input
  • Render to non-html formats such as pdf_document (rjs automatically provides a link to the file)

For ideas on how to get started, take a look in the examples folder:

intro.html

Screenshot of intro.html

scholar.html

Screenshot of scholar.html

About

R in JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%