Home > OS >  Executing Javascript in R?
Executing Javascript in R?

Time:10-23

I am working with the R programming language.

Recently, I learned about the "highcharter" library in R (e.g. enter image description here

Lately, I have been learning how to execute HTML and Javascript code within R (e.g. R markdown). I had the following question:

Is it possible for me to take the code that is provided here and somehow render this code in R, and thereby producing these exact same visualizations in R?

Thanks!

CodePudding user response:

Yes this is possible in RMarkdown (and I assume Quarto, though I haven't made the change yet;-).

The key is to

  1. load JS libraries into the body of the HTML document; this can be easily done using htmltools inside an R code chunk. You can see the relevant JS libraries in the HTML part, as given enter image description here

  • Related