Skip to content

Releases: JDenn0514/surveytidy

surveytidy 0.6.1

Choose a tag to compare

@JDenn0514 JDenn0514 released this 01 Jun 13:35
706d563

Bug fixes

  • mutate() now syncs @metadata (variable labels, value labels, and
    transformation log) for recode columns produced by dplyr::across().
    Previously, only explicitly-named left-hand-side mutations were tracked (#41).

surveytidy 0.6.0

Choose a tag to compare

@JDenn0514 JDenn0514 released this 04 May 00:18
7568f31

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 via vctrs::vec_c()), glimpse() (default mode binds members; .by_survey = TRUE per-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() and replace_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_labels are always preserved.

New error / warning / message classes

  • surveytidy_error_collection_verb_emptied
  • surveytidy_error_collection_verb_failed
  • surveytidy_error_collection_by_unsupported
  • surveytidy_error_collection_select_group_removed
  • surveytidy_error_collection_rename_group_partial
  • surveytidy_error_collection_slice_zero
  • surveytidy_error_collection_pull_incompatible_types
  • surveytidy_error_collection_glimpse_id_collision
  • surveytidy_error_collection_verb_unsupported
  • surveytidy_warning_collection_rowwise_mixed
  • surveytidy_message_collection_skipped_surveys

Dependency changes

  • Adds vctrs (>= 0.6.0) to Imports (used by pull.survey_collection and glimpse.survey_collection).
  • Bumps surveycore minimum-version pin to (>= 0.8.2).

surveytidy v0.4.0

Choose a tag to compare

@JDenn0514 JDenn0514 released this 16 Mar 21:49
84c0f84

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 R factor. Levels are ordered by the numeric value of each value label.
    Accepts ordered, drop_levels, force, and na.rm to 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 .exclude to keep specific levels as NA, and flip_levels
    to reverse the resulting order.

  • make_binary() — converts a dichotomous variable to a 0/1 integer. Thin
    wrapper around make_dicho(); accepts flip_values to control which level
    maps to 1.

  • make_rev() — reverses a numeric scale using min + max - x and remaps
    value labels to match. Issues a warning when all values are NA.

  • make_flip() — reverses the semantic valence of a variable by reversing the
    label strings while keeping the underlying values unchanged. Requires a
    label argument to document the new meaning.