How to Start a Blog with R and Blogdown

Apr 12, 2018 00:00 · 470 words · 3 minute read R Blogdown

Hello World and welcome to my blog! After many months of talking, hemming and hawing, and tinkering around I finally have a live blog. I’m hopeful it will be a platform that will allow me to explore my research interests, learn some new research techniques, and make the occasional fun data visualization. Starting a blog is actually quite easy using R and the Blogdown package, but I figured it may be useful to others if I shared some of my lessons learned.

The first thing you should do is read the Creating Websites with R Markdown ebook by Yihui Xie, Amber Thomas, and Alison Presmanes Hill. It’s fantastic and I would have saved myself quite a bit of work by letting the recommendations of the first chapter sink in. Mainly, I should have avoided trying to pick a fancy theme. There are a number of really nice Hugo themes that make lovely websites, but they do not all support R markdown and are not easily portable to another theme. It took an embarrassing number of readings for this paragraph to sink in.

Another thing to keep in mind is that the more effort you make in a complicated theme, the more difficult it is to switch to other themes in the future, because you may have customized a lot of things that are not straightforward to port to another theme. So please ask yourself seriously, “Do I like this fancy theme so much that I will definitely not change it in the next couple of years?”

I spent far too much time tweaking beautiful themes to only decide I wanted something even prettier or to realize it wasn’t R markdown compatible. My recommendation is to follow Yi Hui’s advice and keep it simple. In the end I decided to go with the cactus plus theme by nodejh after being inspired by Emil Hvitfeldt’s website. They say imitation is the sincerest form of flattery, right?

The book really doesx contain all you need. I did, however, run into a few more hiccups in publishing my website with Netlify. First, Netlify seemed to have some issues in communicating with my Git Hub account, so I ended up using a Git Lab repository instead. This is likely and issue with some software I’m running, but if you run into a similar problem Git Lab is a good option. I personally like that you can have private repositories for free on Git Lab. Second, I would get your site completely up and running on Netlify’s randomly supplied url before customizing. It will allow you to make sure everything is completely working with your theme before adding in your own personal domain. I personally found it a bit frustrating to have a working website one minute and then a broken one the next.

Happy blogging!

tweet Share