haven 2.0.0

We’re pleased to announce that haven 2.0.0 is now on CRAN. haven enables R to read and write various data formats used by other statistical packages by wrapping the ReadStat C library written by Evan Miller. As always, you can find a detailed account of all the changes in this release in the Changelog.

Breaking changes

The biggest change is that labelled() and labelled_spss() now produce objects with class “haven_labelled” and “haven_labelled_spss”. This resolves a problematic clash with the labelled class defined by Frank Harrell’s Hmisc package.

Given Hmisc has been around much longer than haven (Hmisc’s oldest source archive on CRAN is from 2003), it makes sense that haven should be the one to make the change. This will require some changes to packages that use haven, but shouldn’t affect user code.

x1 <- haven::labelled(c(1, 1, 2), c(Grunt = 1, Sgt = 2),
                      label = "Army status")

#> [1] "haven_labelled"
x2 <- haven::labelled_spss(1:10, c(Good = 1, Bad = 8), na_range = c(9, Inf),
                           label = "Quality rating")

#> [1] "haven_labelled_spss" "haven_labelled"

Minor improvements

labelled() and labelled_spss() now support adding the label attribute to the resulting object (as seen in the code above). The label is a short, human-readable description of the object, and is now also used when printing, and can be easily removed using the new zap_label() function.

#> <Labelled double>: Army status
#> [1] 1 1 2
#> Labels:
#>  value label
#>      1 Grunt
#>      2   Sgt

#> [1] 1 1 2
#> attr(,"label")
#> [1] "Army status"
Upcoming events
Atlanta, GA
Oct 14-15
You should take this workshop if you have experience programming in R and want to learn how to tackle larger scale problems. The class is taught by Hadley Wickham, Chief Scientist at RStudio.
San Francisco, CA
Jan 27-30
rstudio::conf 2020 covers all things RStudio, including workshops to teach you the tidyverse, and talks to show you the latest and greatest features.