Image source: Shutterstock

Storytelling for data science bloggers
Tips for crafting your EDS 240 final project
Blogging . . . in a data science program??
It’s actually quite popular!
And I cannot overstate just how much my learning journey benefits from reading personal data science blogs. Just a few reasons:
Your blog can draw viewers to your website
A screenshot from my Google Analytics dashboard. My most highly-visited page is consistently this blog post.
And you can drive engagement by promoting your posts
A screenshot from my Google Analytics dashboard. Views peaked when I shared my blog post on LinkedIn.
Writing (in any form) can feel intimidating . . .
. . . but with practice throughout MEDS, I hope you’ll find blogging to be:
Data science blogging can (and should) be more than just the code you’ve written or the tool you’ve learned – this is what we’ll (primarily) focus on here.
Okay, where do we actually start?
There’s no single formula, but here are some steps you might consider taking to help you craft not only informative, but also engaging blog posts:
Find your topic
Craft your story
Add embellishments
Write it / get feedback / revise / publish
Find your topic
Find your topic
For EDS 240, that topic is chosen for you (though beyond class, you’ll have full creative freedom – consider leaning on your personal brand to help guide your blog post topics).
Reference the final project instructions to remind youself of the goals for this blog post.
Craft your story
Craft your story
Storytelling is a powerful mechanism for effective (data) science communication
Communicating via stories has been found to:

Image source: Shutterstock
From Alex Phillips’ ESM 438 course materials
One storytelling approach: build tension
Good stories build narrative tension over time with a distinct beginning, middle, and end
Freytag’s Pyramid is just one possible narrative structure. From Alex Phillips’ ESM 438 course materials
EXAMPLE: Starwars (A New Hope)
Adapted from Alex Phillips’ ESM 438 course materials and this article on Freytag’s Pyramid
EXAMPLE: Starwars (A New Hope)
Adapted from Alex Phillips’ ESM 438 course materials and this article on Freytag’s Pyramid
EXAMPLE: Starwars (A New Hope)
Adapted from Alex Phillips’ ESM 438 course materials and this article on Freytag’s Pyramid
EXAMPLE: Starwars (A New Hope)
Adapted from Alex Phillips’ ESM 438 course materials and this article on Freytag’s Pyramid
EXAMPLE: Starwars (A New Hope)
Adapted from Alex Phillips’ ESM 438 course materials and this article on Freytag’s Pyramid
EXAMPLE: Starwars (A New Hope)
Adapted from Alex Phillips’ ESM 438 course materials and this article on Freytag’s Pyramid
Storytelling / scene-setting in an intro (and conclusion)
A common approach:
Of course, there’s no one right way to blog (or storytell for that matter) – don’t let this constrain you
EXAMPLE: My first ever blog post
This storytelling / scene-setting all occurs in the intro / conclusion of my blog post, Why create presentations slides bout blogging when you can just blog about it instead?
No one way to tell a story – there are many narrative structures!
Source: Uniting science and stories: Perspectives on the value of storytelling for communicating science (Green et al. 2018); See additional examples of some of the many other possible narrative structures.
ANOTHER EXAMPLE: Maya Gans
From My First Live Coding Interview, by Maya Gans:
Intro: “Yesterday I interviewed for a position maintaining and creating ShinyApps. To call that a JOB is crazy to me. I love developing reactive web applications, the fact that you can get paid to do that is still mind blowing. I’m realizing that having fun at work is actually a possibility!
That said, the data scientist position usually includes a live coding portion. I went into it trying to treat my first one as practice, but every second I didn’t spend typing spanned an eternity. It was horrifying… but thinking about how to solve these questions was also kind of really fun?
I’m fairly certain I won’t get the job. But I’m also certain it was an experience to learn and grow. The interview was so intense that it was pretty easy to recall the questions almost verbatim. I wanted to explore the questions again on my own with no pressure. And I’d love input on how to answer these more elegantly!“
Conclusion: “I left the interview feeling exhausted and deflated. I found myself asking: if I can’t answer these questions, what am I doing trying to become a data scientist? But now that I’ve spent a day to reflect, the interview was an incredible learning experience. It pinpointed concrete areas where I can grow and I honestly had fun thinking about these problems. I’m not sure I’ll ever perform smoothly under pressure, but at the very least I now have a function to separate duplicates from unique values!”
02:00
Storytell by describing your motivation
A few examples:
“In previous years, when it gets to the end of the year, I’ve written blog posts about reflecting on a year of #TidyTuesday data visualisations, or making your own #RStats Wrapped in the style of SpotifyWrapped. This year, I wanted to reflect on some of the changes I’ve made to the way I write R code that have helped to streamline my workflows.” -Nicola Rennie, in Four ways to streamline your R workflows
“Around 11pm last night I saw this tweet [SCREENSHOT OF TWEET]. Tom’s instinct makes perfect sense. My first thought was “CHICKEN WINGS.” So I spent a couple sleepless hours with this weird (and obviously fake) data set about bird attacks in 1974, because it felt like a good October distraction and an opportunity to get some data wrangling rust off.” -Allison Horst, in 1974…bird attacks?
“Hello and welcome back to my multi-part series about what I like to call slidecrafting; The art of putting together slides that are functional and aesthetically pleasing. I will be using quarto presentations. This is the fifth post, you can find all other posts in the slidecraft 101 project.” -Emil Hvitfeldt, in Slidecraft 101: Layout
Add embellishments
Embellishments can improve engagement
Once your story framework is scaffolded, adding in one (or more) of the following embellishment types can help you engage your readers:
Matt Dray and Adriana De Palma’s blog, rostrum.blog is one that often (always?) leverages embellishments to engage their readers. Examples from their post, Base slaps!, on the following slides.
The following slide content is adapted from Alex Phillips’ ESM 438 course materials, with the added example of Base Slaps!.
1. Humor
To start, the title (Base slaps!) is pretty punny (spoiler, it’s about base R):
And ends with this final closing paragraph:
“But ultimately, I just wanted to do this terrible ‘base slaps’/‘slap bass’ pun, sorry. But also, I hear that zoomers say ‘slaps’ to mean ‘cool’. I think. Oh dear, this was a flimsy premise for a talk. Cringe-driven development?”
2. Hooks
Good hooks inspire wonder, curiosity, humor, or other connecting emotions.
3/4. Metaphors & Supporting media
Use metaphors to improve connections or visualizations for your audience. And because blog posts are a versatile medium, don’t shy away from including media that helps to demonstrate examples (and importantly, gives your readers a break from a wall of text and code).
“Re stability, vanilla R has changed little over time. Code written a couple of decades ago has a high chance of running now and will (likely) be executable for a long time into the future. As a result, I contend that R is a horseshoe crab (unchanged for aeons, cryptically beautiful).”
“Note that base R is the literal, unyielding base of the teetering tower of packages used by your project (incredible metaphor).”

Both quotes and xkcd adaptation come from the section titled, Content. Find many more metaphors and media throughout the blog post.
Write it / get feedback / revise / publish
Continue drafting & polishing your post
Getting feedback:
Trade with a friend (even better if you can both give feedback to one another)
See us at student hours!
Opportunity to receive, incorporate and address feedback through FPM #4 revision & resubmission
A few final tips to consider, as appropriate
Include a TL;DR, especially for long posts
TL;DR - internet slang for Too Long; Didn’t Read
Should be a short and succinct summary of your main discussion points. It should not introduce new / additional information.
H/T: Julie Lowndes for recommending using TL;DRs in blog posts! I gave it a shot for the first time in my post, Porting the Openscapes website from blogdown to Quarto.
Use headers to help readers navigate content
Most visitors won’t read your entire blog post, but rather want to jump to the parts that are relevant for them – help them easily navigate by creating clear section headers (e.g. # - ####) and enabling a table of contents.
Set toc: true in either your _quarto.yml file (which would make this the default behavior across all your website pages), or in your blog post’s YAML (which turns on table of contents for just that page). You may also adjust the toc-depth (number of section levels to include; defaults to 3). Screenshot from my blog post, Building (and teaching) a graduate-level data science course
Set the appropriate code chunk options
Your data science blog posts will often include example code. Thoughtfully set your code chunk options so that your examples are easy to follow, but don’t bog down your post by requiring readers to scroll past loonnngggg data frames or messages / warnings (unless there’s an important and demonstrative reason to do so). Consider:
message: false & warning: falseeval: false & echo: trueeval: true & echo: falseFPM #4 details where you should include your code chunk and how to set the code chunk options. Please follow the instructions for your EDS 240 blog post (but consider the above for other / future posts!).
Remember, you can set options in your blog post’s YAML or on a chunk-by-chunk basis.
Consider how you write / display your code
If your blog post contains code, make sure it’s easily readable and generally pleasant to look at:
{ARTofR} package)code-fold: true in your post’s YAML, or on a chunk-by-chunk basis)Strategically assign categories
Add category tags to individual blog posts to strategically group related posts. Some ideas / examples:
Note: To ensure clean URLs, avoid categories with spaces (e.g. rather than data viz, use data-viz)
Embed media
There are a few ways to embed media (screenshots, screen recordings, gifs, images, etc.):
In a code chunk using {knitr} (great when you’re using R):
```{r}
#| eval: true
#| echo: false
#| out-width: "100%"
#| fig-align: "center" # or right, left
#| fig-cap: "Caption goes here"
#| fig-alt: "Alt text goes here"
knitr::include_graphics("file/path/to/image/file")
```Using markdown syntax:
Note: I prefer using CSS for styling and aligning my figure captions. See this example image caption and the associated CSS rules (1 & 2).
End