Designing Simple Websites with Postcards in R

Having a simple website that showcases your current projects and internet presence is a must for anyone in the data science community.

Matt Russell
Towards Data Science

--

A website designed with the postcards package in R.
A website designed with the postcards package in R. Image by author.

I love Mexican food. About two months into the COVID-19 pandemic my wife and I were set to order takeout from our favorite Mexican restaurant. Long story short, we didn’t end up ordering from them. Why? They didn’t have a website that listed their menu or how to contact them for takeout.

The restaurant lost my business because of their lack of a website. While it’s essential for businesses to have a website, it’s becoming increasingly important for working professionals to have a well-designed one.

I always encourage students and young professionals to invest time into developing a website that shows their professional accomplishments and current projects they’re working on. At a minimum, a well-developed LinkedIn profile could do this. Especially for professionals in the data science community, a website that serves as a landing page to point your colleagues, clients, and prospective employers to can set you apart from others and make your work shine.

If you’re not on the web, you don’t exist

For those that have never had a website before, the number of online website builder tools is overwhelming. Many of them (e.g., Squarespace and Wix) are costly and are able to do WAY more than what a data science professional needs, such as keeping a website that provides information on current projects and contact information.

For those that already have one or more websites, you probably don’t have a “landing page” that points to all of the current projects you’re working on. These could include both professional and personal pursuits and ventures. Many people also have affiliations with multiple institutions and organizations (like academics), and you might want to point your audience to the diversity of projects you’re involved with from a single webpage.

That’s why I love postcards, an R package that creates simple websites and landing pages using R Markdown. I learned about it when Roger Peng mentioned on the Effort Report podcast that he had a new website. I was intrigued because it looked like his site was design in R Markdown, which led me to the postcards package.

The postcards package in R

The development version of postcards can be installed in R:

remotes::install_github("seankross/postcards@main")

Any webpage can be created in a single R Markdown document. If you’re using RStudio, create a new project by navigating to File --> New Project --> New Directory. Then navigate to the Postcards Website project type:

Creating a postcards website using RStudio.

Then, specify the directory where you want the store the project. Select from one of four templates to design your site. I chose the Trestles template for my postcards website because it allows for adding more text in an easy-to-read format:

Now, change the title, update the labels and URLs to the social media paces and other pages you want point to, and add some text. RStudio’s R Markdown webpage has excellent information and a cheat sheet for those wanting to learn more about the Markdown language. In the directory where you created the R project, add your own JPEG image. Below is some information I created for a toy website for trees using the Jolla template:

R Markdown version of a postcards site.

Here is the final rendered webpage built with postcards:

A simple website built with postcards in R.

To make your website live, I recommend Netlify Drop. GitHub pages is another method that can be used. In Netlify Drop, drag and drop the R project folder you created for your postcards website that contains the HTML file and you’re all set. Netlify Drop provides free hosting and the URL:

Netlify Drop.

You can chose to purchase a custom domain through Netlify instead of the default site URL provided. I paid USD $10.99 per year for mbrussell.org, which adds some personalization to your webpage. The site will be set to deploy manually.

Conclusion

Having a simple website that showcases your current projects and internet presence is a must for anyone in the data science community. The R package postcards uses R Markdown to create an elegant website. New websites can be set up as projects using RStudio and then deployed to the web using a tool like Netlify Drop.

Special thanks to Sean Kross for the postcards package.

--

--