Motion charts in R

Formatting a motion chart in Google Visualization is as hellish as it’s surprising how simple R makes it. One more reason to learn this underrated language. To create this motion chart, I downloaded the data from here (as CSV) and keyed in the following lines in RStudio:

[code language=”r”]

emissions <- read.csv("–path to file–/emissions.csv", header=T)
emissions_Motion = gvisMotionChart(emissions, idvar="Country", timevar="Year")
cat(emissions_Motion$html$chart, file="emissions.html")


That’s it.

About Me

I’m a science editor and writer in India, interested in high-energy and condensed-matter physics, research misconduct, pseudoscience, science’s relationship with society, epic fantasy, open source/access/knowledge systems, H.R. Giger’s art, Goundamani’s comedy, Factorio, and most things that require a lot of time to get the hang of.