My question is I want to integrate a d3.js visualization to my markdown rather than a link pointing to the visualization on external website. Is there a way to achieve that?
相关问题
- R - Quantstart: Testing Strategy on Multiple Equit
- Using predict with svyglm
- Reshape matrix by rows
- Extract P-Values from Dunnett Test into a Table by
- split data frame into two by column value [duplica
相关文章
- How to convert summary output to a data frame?
- How to plot smoother curves in R
- Paste all possible diagonals of an n*n matrix or d
- ess-rdired: I get this error “no ESS process is as
- How to use doMC under Windows or alternative paral
- dyLimit for limited time in Dygraphs
- Saving state of Shiny app to be restored later
- How to insert pictures into each individual bar in
You have now the R2D3 package that allows that! Rmardown is one way of including D3 visualisation in R https://rstudio.github.io/r2d3/articles/publishing.html#r-markdown
To accomplish adding nonlocal javascript such as
d3.v3.min.js
to our Rmd, there are a couple ways to do it. If you are looking to include local copy ofd3
, it is much easier.This is my favorite way. If for some reason, you would like to see the others, I will be happy to show them. Note: I am still experimenting.
then in the same directory as this .Rmd file, save this
into a file I called
header_include_d3.html
or whatever name you would like. If you change the name, just be sure to change the reference in theincludes
in theyaml
of your Rmd.As I said before, this is much easier if you have d3.js locally that you would like to use.
Also,
<script src='...'></script>
inside the body will work if you are not particular about have your js in the header. In that case, just include it anywhere in the Rmd.