Tag Archives: Programming

VIDEO: How (and why) to create an R notebook for data journalism

Notebooks are one of the ways that data journalists document their work, and make it transparent for others to follow and reproduce. In this video — first made for students on the MA in Data Journalism at Birmingham City University and shared as part of a series of video posts — I explain what notebooks are and walk through how to create one in RStudio.

(Check out yesterday’s video on the pros and cons of R in data journalism for an introduction to R in general)

You can read Knuth on literate programming here; more on the pitfalls of “bad Excel”; and the story about the Excel spreadsheet that led to austerity here.

VIDEO: Why is R used by data journalists?

R — along with Python and JavaScript — is one of the most popular programming languages used by data journalists. In this video — first made for students on the MA in Data Journalism at Birmingham City University and shared as part of a series of video posts — I explain what R is and why you might choose to use it rather than spreadsheets alone, or other languages, in your work.

Oh, and a quick caveat: since Colab notebooks were added to Google Drive, I now prefer Python — but it’s a personal thing, and most of this video can be applied to either language.

The talk by FiveThirtyEight’s Andrew Flowers mentioned in this video can be found here.

Continue reading

Podcast: Data journalism: More important than ever?

data journalism podcast

I took part in a BBC Academy podcast about data journalism last week, along with The Guardian’s Helena Bengtsson and the BBC’s Daniel Wainwright and John Walton, in the wake of the BBC’s annual plan and three-year strategy which included a focus on the “interrogation of data”.

Among other things we talked about why data journalism is increasingly important, what skills are needed (including the role of code), why I’m launching an MA in Data Journalism, and what sorts of stories can be done with those skills.

If you want to listen, it’s now live on the Academy website.

My online journalism Masters course is changing its name. Here’s why

telegraph-newsroom image by alex-gamela

MA student Alex Gamela took this image of the Telegraph newsroom during the first year of the MA

My MA in Online Journalism has a new name: the MA in Multiplatform and Mobile Journalism*. It’s still a course all about finding, publishing and distributing journalism online. So why the name change?

Well, because what ‘online‘ means has changed.

For the last 18 months I’ve been talking to people across the industry, reflecting on the past 7 years of teaching the MA, and researching the forthcoming second edition of the Online Journalism Handbook. Here, then, are the key conclusions I arrived at, and how they informed the new course design:

1: Adapting to new platforms is a specific skill

In the last few years a significant change has taken place. Journalism is now increasingly ‘native’, playing to the strengths of multiple platforms rather than just using them as promotional ‘channels’. It went from web and social to chat, keeps remembering email, and in the near future will take in cars, the home and other connected devices too. Continue reading

Journalists learning how to code is just journalists learning how to publish

google pipes

Recently I read some feedback about a book proposal. The proposal included some chapters on coding for journalists, which prompted one of the reviewers to write:

“I think coding is moving [students] away from the core role of journalism — which is content creation not platform creation”

The debate about coding for journalists has been rumbling for some time now, and my own opinion on the issue has changed over that time. The attitude embodied in that quote is not uncommon among journalism lecturers — but the quote above has helped me realise something that, for me at least, strengthens the ‘journalists should code’ argument.

Let me rephrase it to show how:

“I think publishing is moving [students] away from the core role of journalism — which is content creation not platform creation”

You see my problem? Continue reading

Is data journalism teaching repeating the same mistakes as online journalism teaching?

Shorthand - and you think coding is bad?

Journalists writing code. Shorthand image by Mike Atherton

Is data journalism teaching repeating the same mistakes of online journalism teaching? It’s a genuine question: I don’t know the answer, but I’m seeing some parallels, and I’d welcome a proper debate.

Let me explain what I mean: a decade ago teaching online journalism was problematic: few lecturers were able to teach it. Journalism faculties were full of print and broadcast experience, but very few who had worked online. Continue reading

The 10 most-read posts (and one page) on the Online Journalism Blog in 2014

ojb post frequency 2014

The last 2 months of 2014 saw a return to regular blogging after some quiet periods earlier in the year

2014 was the 10th anniversary of the Online Journalism Blog, so I thought I’d better begin keeping track of what each year’s most-read posts were.

In 2014 the overriding themes for this blog were programming for journalists, web security, and social media optimisation. Here are the most-read posts of the year, plus one surprisingly popular new page with some background and updates. Continue reading

Coding for journalists: 10 programming concepts it helps to understand

If you’re looking to get into coding chances are you’ll stumble across a raft of jargon which can be off-putting, especially in tutorials which are oblivious to your lack of previous programming experience. Here, then, are 10 concepts you’re likely to come across – and what they mean.

1. Variables

cat in a box

Variables are like boxes which can hold different things at different times. Image by Wolfgang Lonien.

A variable is one of the most basic elements of programming. It is, in a nutshell, a way of referring to something so that you can use it in a line of code. To give some examples:

  • You might create a variable to store a person’s age and call it ‘age’
  • You might create a variable to store the user’s name and call it ‘username’
  • You might create a variable to count how many times something has happened and call it ‘counter’
  • You might create a variable to store something’s position and call it ‘index’

Variables can be changed, which is their real power. A user’s name will likely be different every time one piece of code runs. An age can be added to at a particular time of year. A counter can increase by one every time something happens. A list of items can have other items added to it, or removed. Continue reading

Unicorns, racehorses – and a mule cameo: data journalism in 2014

unicorn animated gif

Recently it has felt like data journalism might finally be taking a step forward after years spent treading water. I’ve long said that the term ‘data journalism’ was too generic for work that includes practices as diverse as scraping, data visualisation, web interactives, and FOI. But now, in 2014, it feels like different practitioners are starting to find their own identity.

It starts with the unicorn. Continue reading

Should journalists learn how to code? They already do. (And yes, they should)

Shorthand - and you think coding is bad?

Shorthand image by Mike Atherton

So Olga Khazan had a bad experience with learning how to code (more on that later) and Steve Buttry can think of 6 reasons why journalists should learn how to do just that. The zombie debate ‘Should journalists learn to code?’ stiffens and groans once more, so I thought I’d prod it a little.

Journalists already learn to code. In the UK they learn shorthand – possibly the most esoteric code there ever was. We also learn a particular coding language: English. This language is taught in schools and involves using a series of 26 characters to encode objects, actions, and descriptions. You may have a similar language you have to learn in your own country. What a drag.

Why do we learn these languages? To save time, and to improve accuracy – two things that should be important to every journalist. Continue reading