New features
null_action
argument to val_labels()
, val_label()
and a .null_action
argument to set_value_labels()
, add_value_labels()
and remove_value_labels()
(#145)update_variable_labels_with()
and update_value_labels_with()
allowing to update variable/value labels with a custom function (#153)Bug fix
print.look_for()
when console pane is physically shrunk too small (#148)recode.haven_labelled()
when .x
contains NA
and .combine_value_labels = TRUE
(#151)New features
label_attribute()
, get_label_attribute()
and set_label_attribute()
to manipulate the “label” attribute on any object (#142)get_variable_labels()
, get_value_labels()
, get_na_values()
and get_na_range()
identical to var_label()
, val_labels()
, na_values()
and na_range()
, respectivelyto_character()
method for data frames (#140)Improvements
set_value_labels()
, add_value_labels()
, remove_value_labels()
, set_variable_labels()
, set_na_range()
and set_na_values()
can now be applied on a vector (#126)null_action
for var_label()
when applied on a data frame (#131)look_for()
now returns "missing"
(number of NA
s) by default (#133)Bug fixes
print.look_for()
(#135)unlabelled()
for classic vectors, now remained unchanged (#137)look_for()
now accepts survey
objects (#121)look_for()
when no keyword is provided (#116)user_na_to_tagged_na()
(#114)look_for() improvements:
look_for_and_select()
(#87)look_for()
can now search within factor levels and value labels (#104)improvements for tagged NAs:
user_na_to_tagged_na()
, tagged_na_to_user_na()
and tagged_na_to_regular_na()
explicit_tagged_na
in to_factor()
and to_character()
unique_tagged_na()
, duplicated_tagged_na()
, order_tagged_na()
, sort_tagged_na()
(#90, #91)other improvements:
is_user_na()
and is_regular_na()
na_range()
or na_values()
to a factor will now produce an errorforeign_to_labelled()
for Stata files (#100)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)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)is_prefixed()
to check if a factor is prefixedna_range<-
and na_values<-
when applied to a data.frame (#80).values
argument has been added to set_na_values()
and set_na_range()
, allowing to pass a list of values.strict
option has been added to set_variable_labels()
, set_value_labels()
, add_value_labels()
, remove_value_labels()
, set_na_values()
and set_na_range()
, allowing to pass values for columns not observed in the data (it could be useful for using a same list of labels for several data.frame sharing some variables) (#70)copy_labels()
is less restrictive for non labelled vectors, copying variable label even if the two vectors are not of the same type (#71).strict
option has been added to copy_labels()
(#71)look_for()
has been redesigned:
look_for()
now returns a tibblelookfor_to_long_format()
to convert results with one row per factor level and per value labelconvert_list_columns_to_character()
to convert list columns to simpler character vectorsgenerate_dictionary()
is an equivalent of look_for()
set_variable_labels
, set_value_labels
, add_value_labels
, and remove_value_labels
now accept “tidy dots” (#67 @psanker)names_prefixed_by_values()
to get the names of a vector prefixed by their corresponding value.keep_value_labels
argument for recode.haven_labelled()
.combine_value_labels
argument for recode.haven_labelled()
(#61)drop_unused_value_labels()
method.labels
argument for set_value_labels()
user_na_to_na
argument has been added to to_character.haven_labelled()
%>%
is now imported from dplyr
haven
update_labelled()
has been improved to allow to reconstruct all labelled vectors created with a previous version of haven
keep_var_label
for remove_labels()
unlabelled()
when applied on a vectorunclass = TRUE
with to_factor()
, attributes are not removed anymoreunlabelled()
look_for()
(#52 by @NoahMarconi)val_labels_to_na()
documentationna_range()
and na_values()
: variable labels are now preserved (#48, thanks to @mspittler)copy_labels_from()
, compliant with dplyr
syntaxupdate_labelled()
is now more strict (#42 by @iago-pssjd)look_for()
and lookfor()
imported from questionr
(#44)unlist
option for var_label()
tagged_na()
and similar functions are now imported from 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.unclass
option in to_factor()
, to be used when strict = TRUE
(#36)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)to_factor()
bug fix then applied on a data.frame (#33)update_labelled()
bug fix then applied on a data.frame (#31)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
.update_labelled()
could be used to convert data imported with an older version of haven
to the new classes.user_na_to_na
option added to to_factor()
foreign_to_labelled()
now import SPSS missing values (#27)strict
argument added to to_factor()
(#25)remove_attributes()
preserve character vectors (#30)dplyr::recode()
method to be compatible with labelled vectors.copy_labels()
now copy also na_range
and na_values
attributes.remove_attributes()
drop_unused_labels
could now be used with to_factor.data.frame()
to_labelled()
method when applied to a factordata.frame
(#20)haven
na_values()
, na_range()
, set_na_values()
, set_na_values()
, remove_user_na()
, user_na_to_na()
.remove_labels()
has been updated.set_variable_labels()
, set_value_labels()
, add_value_labels()
and remove_value_labels()
compatible with %>%
.remove_val_labels
and remove_var_label()
.to_character.labelled()
when applied to data frames.to_factor()
, to_character()
and to_labelled.factor()
now preserves variable label.to_factor()
when applied to data frames.haven
, labelled
doesn’t support missing values anymore (cf. https://github.com/hadley/haven/commit/4b12ff9d51ddb9e7486966b85e0bcff44992904d)to_character()
(cf. https://github.com/larmarange/labelled/commit/3d32852587bb707d06627e56407eed1c9d5a49de)to_factor()
could now be applied to a data.frame (cf. https://github.com/larmarange/labelled/commit/ce1d750681fe0c9bcd767cb83a8d72ed4c5fc5fb)data.table
is available, labelled attribute are now changed by reference (cf. https://github.com/larmarange/labelled/commit/c8b163f706122844d798e6625779e8a65e5bbf41)zap_labels()
added as a synonym of remove_labels()