surveytidy 0.6.0
New features
survey_collection support
Collection-aware methods for all standard dplyr/tidyr verbs are now
dispatched per-survey when called on a survey_collection. The result
is a new survey_collection whose @id, @if_missing_var, and
@groups properties are preserved.
- Data-masking verbs:
filter(),filter_out(),mutate(),arrange() - Tidyselect verbs:
select(),relocate(),rename(),rename_with(),drop_na(),distinct(),rowwise() - Grouping verbs:
group_by(),ungroup(),group_vars(),is_rowwise() - Slicing verbs:
slice(),slice_head(),slice_tail(),slice_min(),slice_max(),slice_sample() - Collapsing verbs:
pull()(returns a vector viavctrs::vec_c()),glimpse()(default mode binds members;.by_survey = TRUEper-member)
The .if_missing_var argument on each verb ("error" (default) or "skip") lets you override the collection's stored missing-variable behaviour for a single call. Skipped surveys are reported via the typed message class surveytidy_message_collection_skipped_surveys.
The 6 join verbs (left_join(), right_join(), inner_join(), full_join(), semi_join(), anti_join()) error with surveytidy_error_collection_verb_unsupported when called on a survey_collection. Apply joins inside a per-survey pipeline before constructing the collection.
surveycore re-exports
library(surveytidy) is now sufficient to use the collection construction and setter API. The following surveycore symbols are re-exported:
as_survey_collection()set_collection_id()set_collection_if_missing_var()add_survey()remove_survey()
Bug fixes
replace_when()andreplace_values()no longer retain stale value labels for values absent from the recoded result. Previously, collapsing or replacing values left label entries (e.g."High" = 4) attached to a vector that contained no such values. User-supplied.value_labelsare always preserved.
New error / warning / message classes
surveytidy_error_collection_verb_emptiedsurveytidy_error_collection_verb_failedsurveytidy_error_collection_by_unsupportedsurveytidy_error_collection_select_group_removedsurveytidy_error_collection_rename_group_partialsurveytidy_error_collection_slice_zerosurveytidy_error_collection_pull_incompatible_typessurveytidy_error_collection_glimpse_id_collisionsurveytidy_error_collection_verb_unsupportedsurveytidy_warning_collection_rowwise_mixedsurveytidy_message_collection_skipped_surveys
Dependency changes
- Adds
vctrs (>= 0.6.0)toImports(used bypull.survey_collectionandglimpse.survey_collection). - Bumps
surveycoreminimum-version pin to(>= 0.8.2).