Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 3

Imbedding Leaflet Map Widget Created in R into Personal Site and README.md

Hello,

 

I created two Leaflet Maps in R and uploaded them into my working directory as a HTML Widget. How can I embed them into my page and my README.md page? I have seen others do it and tried looking for solutions online but it was not clear how it was done. 

 

More Details on the Maps:

Snippet of the code used to create the Leaflet Map into a Widget:

 

MapCode.PNG

 

Actual Leaflet Map:

Map.PNG

 

2 Replies
Community Manager
Message 2 of 3

Re: Imbedding Leaflet Map Widget Created in R into Personal Site and README.md

Hi @aylinko,

 

I'm not super familiar with R, but I'd like to try and help you out. You mentioned that you saved the widget into your working directory as an HTML widget, correct? Following the information in this tutorial about displaying R Markdown files using GitHub Pages, it looks like you should be able to import that widget into an R Markdown file and have it displayed as the README file or on GitHub Pages, if I'm reading it correctly.

 

Let me know if that helps you get a bit further. It might also help to see your repository to help you troubleshoot more directly.

 

Thanks!

Copilot Lvl 2
Message 3 of 3

Re: Imbedding Leaflet Map Widget Created in R into Personal Site and README.md

Hello that-pat, 

 

Thanks for trying to help. The issue is I already created the leaflet map in R Studio and then saved it as html widget in my working directory used for R Studio. Then uploaded the file into my repo in GitHub. It can be found 

here : https://github.com/aylinko/globalterrorism 

It is saved as a globalterrorism_map.html and just tried the following code to paste the map into the README file but did not work :

 

 

{% include globalterrorism_map.html id="htmlwidget-1d763eeb152218571eeb" title="Global Terrorism" %} 

 

I assume the same would follow for posting it on a Github website.