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.
The biggest change is that
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") class(x1) #>  "haven_labelled"
x2 <- haven::labelled_spss(1:10, c(Good = 1, Bad = 8), na_range = c(9, Inf), label = "Quality rating") class(x2) #>  "haven_labelled_spss" "haven_labelled"
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
x1 #> <Labelled double>: Army status #>  1 1 2 #> #> Labels: #> value label #> 1 Grunt #> 2 Sgt zap_labels(x1) #>  1 1 2 #> attr(,"label") #>  "Army status"
A special thanks to Karl Ove Hufthammer for implementing
zap_label(), as well as to the 30 others who contributed to this release: @ajdamico, @alexeyknorre, @batpigandme, @beckerbenj, @caayala, @Crismoc, @dar143, @davidc92, @elbersb, @gergness, @hadley, @helge-baumann, @HughParsonage, @iadli100, @JanMarvin, @jeffeaton, @jimhester, @jmetzel, @larmarange, @lemzwerg, @Majid-Eismann, @nealrichardson, @oscardssmith, @philstraforelli, @reyntjesr, @rubenarslan, @sjkiss, @visseho, @zkamvar, and @zross.