Little function to download ESS data on the go


Yes, there is a recently published brand new R package ess for downloading European social survey data, I tried it, although at this point it is quite limited.
What are the good sides of ess package?

  • it downloads data, sometimes several data at a time

What’s not so good?

  • when it downloads several rounds, you get a list of data instead of integrated dataset;
  • it can only download one country data at a time;
  • it tuned up for use in Stata, but not in R, for example, I couldn’t see most of the value labels.

So, I thought it would be useful to have a customizable function (instead of package) to do the same thing, but better. For example, you can keep labels to use, for example, with my label_book.


Don’t put more than one country or more than one round – it won’t work. For countries, use iso2c codes, or “all”. This function will expire when ESS updates its data versions, but it happens about twice a year, and can be fixed manually.


#1. Source the function
eval(parse(text =getURL("")))
#2. Enjoy it
ESS2 <- download_ess(round=2, country="all", "") #Add your registered on ESS website mail here
ESS6.Russia <- download_ess(round=6, country="RU", "")

Function itself

download_ess <- function(round, country="all", user) {
 #1.Create url
 if(country!="all") {
 download.url <- paste("", round, country, "", country, "&y=", round*2+2000, sep="")
 } else {
 version <- c("06_5", "03_5", "03_6", "04_4", "03_3", "02_3", "02_1", "01")[round]
 download.url <- paste("", round, "e", version, "", round*2+2000, sep="")
 #2. Download data
 a<-POST("", body = list(u=user))
 # Download
 data.file <- GET(download.url)
 # Write temporary file
 writeBin(content(data.file, "raw"), paste(tempdir(), ""))
 # Unzip
 path<-utils::unzip(paste(tempdir(), ""))
 #3. Read in with haven package

UPD. Now these functions are a part of my R package LittleHelpers.