← Back to all sparks
S

surveytidy

INFRA · APIS
Velocity0.0

Tidy 'dplyr'/'tidyr' Verbs for Survey Design Objects

surveytidy taught every dplyr verb to operate on a whole collection of surveys at once.

survey-statisticstidyversedplyr-verbsmetadata-trackingr-packages
Current state
surveytidy is the tidyverse-facing half of a two-package survey stack, wrapping survey design objects from surveycore so filter, mutate, select and the rest work on them while carrying variable labels, value labels and a transformation log alongside the data. The May release extended that verb surface to survey_collection, the abstraction surveycore uses to hold several surveys as one object, so a pipeline written once dispatches across every member.
Where it's heading
The package is being built in two layers that arrive in order: vector-level transformations first, structural dispatch second. The make_* family in 0.4.0 handles the recoding that survey work actually consists of — labelled to factor, multi-level to dichotomous, scale reversal, valence flipping — with value labels propagating automatically. Collection support then applies data-masking, tidyselect, grouping, slicing and collapsing verbs per survey, with joins explicitly refused and a typed message reporting which surveys were skipped. Metadata fidelity is the recurring bug source: labels surviving across(), stale labels left behind by recoding, the transformation log keeping up with what the verbs did.
Prediction
Joins are the one verb family that errors on collections, with users directed to join before constructing the collection, so that restriction is the clearest outstanding gap. The re-export of surveycore's collection constructors suggests the package is positioning itself as the single import users need, which points toward more re-exports as surveycore's stable API settles.

Recent moves

  1. 2mo ago

    mutate() syncs metadata for across() recodes

    Closes a hole in the metadata tracking that is the package's main promise: only explicitly named left-hand-side mutations were being logged, so columns recoded through dplyr::across() lost their labels and their place in the transformation log.

    View source ↗
  2. 3mo ago

    dplyr and tidyr verbs dispatch across survey collections

    The tidy half of the collection abstraction surveycore had already introduced: data-masking, tidyselect, grouping, slicing and collapsing verbs now run per member and return a collection with its id, missing-variable policy and grouping preserved. Joins are refused outright with a typed error directing users to join before building the collection, and surveycore's constructors are re-exported so one library() call suffices.

    View source ↗
  3. 5mo ago

    Five label-aware recoding functions for use inside mutate()

    The transformation layer the later structural work sits on. make_factor(), make_dicho(), make_binary(), make_rev() and make_flip() cover the recodes survey analysis repeats constantly, and all five propagate value labels and accept label and description arguments so metadata is attached in the same step rather than reapplied afterward.

    View source ↗