Data visualisation challange at useR 2014 conference

May 27, 2014
By

(This article was first published on SmarterPoland » PISA in english, and kindly contributed to R-bloggers)

Familiar with R and DataVis? Take a try in PISA data visualisation contest for useR2014 participants.
There are two contest tracks. In each you can win 700$.

More information about the contest can be found here: http://www.oecd.org/pisa/pisaproducts/datavisualizationcontest.htm.

The prizes are funded by The Organisation for Economic Co-operation and Development (OECD) and tracks are related to data from The Programme for International Student Assessment (PISA).

Note that the deadline is Sunday 29 june 2014 Pacific Daylight Time.

Below you can find an simple example how to read PISA data and plot some basic graphs.

Let’s see in which countries pupils have high average reading + math score and in which countries pupils are on average better in math than reading.

library(ggplot2)
# read students data from PISA 2012
# directly from URL
con <- url("http://beta.icm.edu.pl/PISAcontest/data/student2012.rda")
load(con)
# calculate weighted mean from math / reading scores
# W_FSTUWT stands for final weights
mathScores <- unclass(by(student2012[,c("PV1MATH", "W_FSTUWT")], 
                 student2012$CNT,
                 function(x) weighted.mean(x[,1], x[,2])) )
readScores <- unclass(by(student2012[,c("PV1READ", "W_FSTUWT")], 
                 student2012$CNT,
                 function(x) weighted.mean(x[,1], x[,2])) )
# create a data.frame with scores and country names
# remove names with ( in name)
readMathScores <- data.frame(Country=names(readScores), readScores, mathScores)
readMathScores <- readMathScores[-grep(readMathScores$Country, pattern="(", fixed=TRUE),]
 
ggplot(readMathScores, aes(x=mathScores + readScores, y = mathScores - readScores, label = Country)) + 
  geom_text() +
  theme_bw()

Let’s add country sizes to the plot.

sizeScores <- unclass(by(student2012[,"W_FSTUWT"], 
                         student2012$CNT,
                         sum) )
# create a data.frame with scores, sizes and country names
# remove names with ( in name)
readMathScores <- data.frame(Country=names(readScores), readScores, mathScores, sizeScores)
readMathScores <- readMathScores[-grep(readMathScores$Country, pattern="(", fixed=TRUE),]
 
ggplot(readMathScores, aes(x=mathScores + readScores, y = mathScores - readScores, label = Country, size = sqrt(sizeScores))) + 
  geom_text() +
  theme_bw() + theme(legend.position="none")

I am very eager to see winning submissions.

To leave a comment for the author, please follow the link and comment on his blog: SmarterPoland » PISA in english.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.