Releases: JDenn0514/surveytidy
Release list
surveytidy 0.6.1
Bug fixes
mutate()now syncs@metadata(variable labels, value labels, and
transformation log) for recode columns produced bydplyr::across().
Previously, only explicitly-named left-hand-side mutations were tracked (#41).
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).
surveytidy v0.4.0
New features
Survey-aware transformation functions
Five vector-level transformation functions are now available for converting,
collapsing, and reversing variables inside mutate(). All five propagate value
labels automatically and accept .label and .description arguments to
attach metadata in a single step.
-
make_factor()— converts labelled, numeric, character, or factor vectors
to an Rfactor. Levels are ordered by the numeric value of each value label.
Acceptsordered,drop_levels,force, andna.rmto control level
creation. -
make_dicho()— collapses a multi-level factor to two levels by stripping
the first word of each label and merging labels that reduce to the same
stem. Accepts.excludeto keep specific levels asNA, andflip_levels
to reverse the resulting order. -
make_binary()— converts a dichotomous variable to a 0/1 integer. Thin
wrapper aroundmake_dicho(); acceptsflip_valuesto control which level
maps to 1. -
make_rev()— reverses a numeric scale usingmin + max - xand remaps
value labels to match. Issues a warning when all values areNA. -
make_flip()— reverses the semantic valence of a variable by reversing the
label strings while keeping the underlying values unchanged. Requires a
labelargument to document the new meaning.