ess 0.1.1 is out!

PUBLISHED ON MAR 4, 2018

The new version of the ess package is out! ess 0.1.1 fixes some bugs and inconsistencies across the package and has one important new feature and a change that breaks backward compatibility. You can see all changes here.

Install the latest version 0.1.1 from CRAN with install.packages("ess").

New features

When downloading any round(s) from the European Social Survey the files are always accompanied by a script that recodes values like 6, 7, 8 and 9 or 96, 97, 98 and 99 to missings, depending on the question. This is a bit tricky because a question with a scale from 1 to 5 will have 6 to 9 as missing values and a question with a scale from 1 to 10 will have the missing values set as 96 to 99. The new remove_missings() function removes all missing values from all questions.

For example…

library(tidyverse)
library(ess)

clean_df <-
  ess_rounds(1, "your_email@gmail.com") %>%
  recode_missings()

… will set all the missing categories to NA. That is, the 6 to 9 and 96 to 99 categories on the specific questions. It gives you flexibility in recoding specific categories such as ‘Don’t Know’, ‘Refusal’ or both.

another_clean_df <-
  ess_rounds(1, "your_email@gmail.com") %>%
  recode_missings(c("Refusal", "No answer"))

See ?recode_missings for the missing categories that are available for recode.

However, I do not advise recoding missing values right away if you’re exploring the dataset. If you want to manually recode missing values you can use the recode_numeric_missing() and recode_strings_missing correspondingly on numeric and string variables. They work the same as recode_missings but accept a vector of class labelled, the class of each of the columns that returns the ess_* functions.

For example

another_clean_df$tvtot <-
  recode_numeric_missing(
    another_clean_df$tvtot,
    "Don't know"
    )

works for recoding the “Don’t know” category. By default all missing values are chosen.

Note that both sets of functions only work with labelled numeric vectors from the haven package. If you use the ess package that’s taken care of. If you download the data manually, you must read it with the haven package for these functions to work.

There are also two new show_* functions, namely show_themes and show_rounds_country.

The first one returns all available themes…

show_themes()
##  [1] "Ageism"                            
##  [2] "Citizen involvement"               
##  [3] "Democracy"                         
##  [4] "Economic morality"                 
##  [5] "Family work and well-being"        
##  [6] "Gender, Household"                 
##  [7] "Health and care"                   
##  [8] "Human values"                      
##  [9] "Immigration"                       
## [10] "Justice"                           
## [11] "Media and social trust"            
## [12] "Personal ... well-being"           
## [13] "Politics"                          
## [14] "Public attitudes to climate change"
## [15] "Social inequalities in health"     
## [16] "Socio demographics"                
## [17] "Subjective well-being..."          
## [18] "Timing of life"                    
## [19] "Welfare attitudes"

… but doesn’t haven a corresponding ess_* function. This means that it works purely for descriptive purposes.

Additionaly, show_rounds_country returns all countries that participated in a give round.

show_rounds_country(rounds = 2)
##  [1] "Austria"        "Belgium"        "Czech Republic" "Denmark"       
##  [5] "Estonia"        "Finland"        "France"         "Germany"       
##  [9] "Greece"         "Hungary"        "Iceland"        "Ireland"       
## [13] "Italy"          "Luxembourg"     "Netherlands"    "Norway"        
## [17] "Poland"         "Portugal"       "Slovakia"       "Slovenia"      
## [21] "Spain"          "Sweden"         "Switzerland"    "Turkey"        
## [25] "Ukraine"        "United Kingdom"

You could use this to see which countries participated in all rounds. For example..

all_countries <-
  map(show_rounds(), ~ show_rounds_country(.x)) %>%
  reduce(intersect)

all_countries
##  [1] "Belgium"        "Finland"        "France"         "Germany"       
##  [5] "Ireland"        "Netherlands"    "Norway"         "Poland"        
##  [9] "Slovenia"       "Sweden"         "Switzerland"    "United Kingdom"

Breaking changes

Finally, there is one change that breaks backward compatability. All the ess_* functions always used to return a list, regardless of the number of rounds that were requested. Now, ess_* functions return a tibble whenever it is request only one round and a list when more than one round is requested.

For example

ess_rounds(1, "your_email@gmail.com")

will return a tibble but…

ess_rounds(1:3, "your_email@gmail.com")

…will return a list with each tibble in a slot.

For more concrete examples check out the new website of the ess here. If you have any ideas for features or find a bug, please report here.

TAGS: PACKAGES, R
comments powered by Disqus