look_for() improvements:

improvements for tagged NAs:

other improvements:

  • new helper recode_if() for recoding values based on condition, variable and value labels being preserved (#82)
  • look_for() could be time consuming for big data frames. Now, by default, only basic details of each variable are computed. You can compute all details with details = "full" (#77)
  • printing of look_for() results has been updated and do not rely anymore on pillar (#85)
  • to_labelled() can properly manage factors whose levels are coded as “[code] level”, as produced by to_factor(levels = "prefixed") (#74 @courtiol)
  • new function is_prefixed() to check if a factor is prefixed
  • bug fix for na_range<- and na_values<- when applied to a data.frame (#80)
  • fixes for haven 2.3.0 (#59 by @hadley)
  • correct re-export of functions from haven
  • update_labelled() has been improved to allow to reconstruct all labelled vectors created with a previous version of haven
  • var_label(), applied to a data.frame, now accepts a character vector of same length as the number of columns.
  • set_variable_labels has a new .labels argument.
  • New unclass option in to_factor(), to be used when strict = TRUE (#36)
  • Following haven version 2.1.0, it is not mandatory anymore to define a value label before defining a SPSS style missing value. labelled_spss(), na_values() and na_range() have been updated accordingly (#37)

BREAKING CHANGE

  • Following version 2.0.0 of haven, labelled() and labelled_spss() now produce objects with class “haven_labelled” and “haven_labelled_spss”, due to conflict between the previous “labelled” class and the “labelled” class used by Hmisc.
  • A new function update_labelled() could be used to convert data imported with an older version of haven to the new classes.

Other changes

  • bug fix: argument drop_unused_labels could now be used with to_factor.data.frame()
  • new labels argument for to_labelled() method when applied to a factor
  • bug fix: appropriate column names with data.frame (#20)