Dynamic dataviz generated with R as an embed code

12 juin 2019

Rframe: a WordPress plugin to embed the HTML generated with R.

How to embed within a post (or a page) a dynamic dataviz whose HTML code was generated with R? The “Rframe” plugin allows you to answer the question in a way that is not too complicated. Its advantage is to be light and not to have any problems of compatibility. This plugin is available in FR and in EN.

Plugin installation

1) Download Rframe (zip file)

2) Add it to your WordPress’ plugins

3) Activate it, a new post type “Rframe” will appear in the menu

Manual

1) In R Studio, export the dataviz : Export / Save as web page

 

2) Open the HTML file in a code editor, select all (CTRL + A) and then copy (CTRL + C)

3) Create a new post “Rframe” in WordPress

4) Add a title (to find it easily just in case) and paste the code in the ad hoc field (CTRL + V)

5) Save it

6) Copy the iframe code

7) Create a new article in WordPress. In “text” mode, copy the code.

You can change the width of the iframe in the code (by default, 100% to fit the width of the text box). You can also use a WP plugin to integrate iframes more intuitively.

The example below was made with the package Highcharter. Here’s the original post type

That’s it!

# #