First Blog Post

”…start a blog, and write about data science”  David Robinson, 2017

This was the advice that called out to me earlier this year whilst listening to the DataFramed podcast where Hugo Bowne-Anderson interviews David Robinson. I had only just begun learning R at this point, completing some introductory courses on DataCamp and had stumbled across this podcast series in the process. I made a mental note, and thought “yes, I will start a blog, I just need to learn R and start working on my own projects. Easy!”

Well, some 10 months later (I have a full-time job and a toddler, so these things take time) and I’m finally ready to start that blog! Just one question, “How do I start a blog?”

This is not intended to be a step-by-step technical guide on how to build a blog, but by sharing my experience and giving some pointers along the way, hopefully it gives others the encouragement to build a blog too. If I can do it, so can you!

Blogdown

Like most things in R, there’s probably already a package for that. That package in this instance is blogdown. This seems like a pretty good way to go for someone like me, with next to no experience of web languages and web design, but slightly more experience in rmarkdown. If you go down the Blogdown route, then there’s only one place to start: the book that is freely available online. Essentially, your website is built from rmarkdown and markdown, abstracting away the nitty gritty of web development. For the full benefits of this approach, and a step-by-step guide of how to do it, read the book. If a website novice like me can build a blog, then so can you! To get started with a draft version of your website is incredibly easy. With just 2 simple commands you can install Blogdown and install Hugo (see next section). You can start a blogdown project in the same way you start any old R project from the RStudio IDE. Under ‘Project Type’, you should see the ‘Website using Blogdown’ option. I suggest you just dive right in and do it! It generates a bunch of files and folders for you in your project directory. I found just spending a fair amount of time exploring these files and trying to work out how it all fits together was invaluable. You can view what your website looks like in your local web browser by using the ‘Serve Site’ Add-in. Each time you make and save a change you can see the changes instantly. Then you can start adding your own posts, which again is super easy, using the ‘New Post’ Add-in. After some time spent playing around with my new website, I decided I wanted to try a different theme. That’s where Hugo comes in.

Hugo

Hugo is a static website generator. It takes your files and turns them into a website. There is a default theme that blogdown gives you, but you can spend hours (which I did) deciding on another theme from here. I finally chose the creative portfolio theme. I liked the idea of having my data visualisations, and not just the blog post title, appear on the home page. My advice, as mentioned in the book, is to pick a theme that is not overly complicated. The book mentions a few themes, and the one I chose is amongst them, so I felt it was a pretty safe bet. As I later discovered, one of the blogdown book authors, Amber Thomas uses the same theme. Turns out this is super useful, as I could snoop around her GitHub repository which helped me work out a few things. Thanks Amber! Her wonderful blog certainly gives me something to strive towards! Once I decided on this new theme, the easiest thing to do is go back to the start and create a new project, entering the GitHub repository of your theme in the options. I hadn’t really done much with my initial go, so this was no problem. My recommendation would be to choose a theme right at the start, and stick with it. Scary I know, it’s quite the commitment!

Taking things further

Once you have your theme sorted (adjusting the config.toml file as required), along with your ‘About Me’ and at least 1 blog post, you might want to start customising the look of your website. This is something I plan on developing over time. I’ve only recently learnt a bit about HTML from dipping my toes into shiny web apps, and until a few months ago thought CSS was just an electro-indie band from Brazil. In the themes folder should live a static folder which stores your css files. I’ve added a few things to the custom.css file to format my R code chunks, but that’s it at the moment. There are other things I would like to change about the appearance, but let’s not run before we can walk.

GIT: the final frontier

Once you are happy with your blog and how it looks in your local browser, the final step is to share it with the world! The book recommends Netlify, and again I have followed their wisdom. You can just drop the public folder in your blog project repository into the Netlify page and it deploys your website and gives it a randomly generated name (which you can change). The downside of this is every time you make a change to your website you have to manually drop your folder in again. This is where it would be really handy if I was using GIT and Github, but alas I haven’t quite got there yet. It still scares me for some reason. With a GIT repository set up for your blog, the idea is that every time you make an update to the source files, the changes will be automatically deployed. Sounds beautiful, if anyone knows any good resources to hold my hand through getting to grips with GIT then please let me know. It is the final piece to fall in my Summer of Data Science 2018 goals, only 2 seasons too late!

Still, as 2018 comes to an end, I’m happy with what I’ve achieved. Having started the year as an R novice, I’m ending it with a blog about R, made with R!