MyNixOS website logo
Description

Analysis Blinding Tools.

Provides tools for analysis blinding in confirmatory research contexts by masking and scrambling test-relevant aspects of data. Vector-, data frame-, and row-wise operations support blinding for hierarchical and repeated-measures designs. For more details see MacCoun and Perlmutter (2015) <doi:10.1038/526187a> and Dutilh, Sarafoglou, and Wagenmakers (2019) <doi:10.1007/s11229-019-02456-7>.

vazul

R-CMD-check Codecov test coverage Lifecycle: experimental CRAN status

vazul is an R package for analyis blinding in research contexts. It offers two main approaches to anonymize data while preserving analytical validity: masking (replacing values with anonymous labels) and scrambling (randomizing the order of existing values).

Analysis Blinding Approaches

Masking replaces original values with anonymous labels, completely hiding the original information:

treatment <- c("control", "treatment", "control")
mask_labels(treatment)
#> "masked_group_01" "masked_group_02" "masked_group_01"

Scrambling preserves all original values but randomizes their order:

scramble_values(treatment) 
#> "treatment" "control" "control"  # Same values, different order

Installation

You can install the released version of vazul from CRAN with:

install.packages("vazul")

Or the development version from GitHub with:

remotes::install_github("nthun/vazul")

Functions

Masking Functions

Replace categorical values with anonymous labels to completely hide original information.

mask_labels() - Mask vector values

library(vazul)

# Basic masking
treatment <- c("control", "treatment", "control", "treatment")
set.seed(123)
mask_labels(treatment)
#> "masked_group_01" "masked_group_02" "masked_group_01" "masked_group_02"

# Custom prefix
mask_labels(treatment, prefix = "group_")
#> "group_01" "group_02" "group_01" "group_02"

mask_variables() - Mask data frame columns

df <- data.frame(
  condition = c("A", "B", "A", "B"),
  treatment = c("ctrl", "test", "ctrl", "test"),
  score = c(85, 92, 78, 88)
)

# Mask multiple columns
mask_variables(df, c("condition", "treatment"))

# Use tidyselect helpers
mask_variables(df, where(is.character))

The .across_variables parameter allows for consistent masking across multiple columns (e.g., longitudinal data in wide format).

df <- data.frame(
  wave_1 = c("A", "B", "A"),
  wave_2 = c("B", "A", "B"),
  score = c(10, 20, 30)
)

# Mask across variables consistently
mask_variables(df, starts_with("wave_"), .across_variables = TRUE)

Scrambling Functions

Randomize the order of values while preserving the original data content.

scramble_values() - Scramble vector order

# Numeric data
set.seed(123) 
scramble_values(1:5)
#> [1] 3 2 5 4 1

# Categorical data
scramble_values(c("A", "B", "C", "A", "B"))
#> [1] "B" "A" "C" "B" "A"

scramble_variables() - Scramble data frame columns

df <- data.frame(x = 1:6, group = rep(c("A", "B"), each = 3))

# Scramble across entire column
scramble_variables(df, "x")

# Scramble within groups
scramble_variables(df, "x", .groups = "group")

# Using dplyr grouping
library(dplyr)
df |> group_by(group) |> scramble_variables("x")

Row-wise scrambling: Use .byrow = TRUE to shuffle values within each row across the selected columns.

df_items <- data.frame(
  item1 = c(1, 4, 7),
  item2 = c(2, 5, 8), 
  item3 = c(3, 6, 9)
)

# Shuffles values horizontally within each row
scramble_variables(df_items, item1:item3, .byrow = TRUE)

Datasets

MARP Dataset

Many Analysts Religion Project data: 10,535 participants across 24 countries studying religiosity and well-being.

Williams Dataset

Experimental study data: 112 participants examining risk-taking behavior under different wealth conditions.

Explanation of the package name

Vazul was a Hungarian prince in the 11. century. He was blinded by the king to become unfit for the throne. More info: https://en.wikipedia.org/wiki/Vazul

Documentation

  • Function help: ?mask_labels, ?scramble_values, etc.
  • Package website: https://nthun.github.io/vazul/

Authors

  • Tamás Nagy - Package author and maintainer
  • Márton Kovács - Author
  • Alexandra Sarafoglou - Data contributor and author

Citation

Nagy, T., Kovács, M., & Sarafoglou, A. (2026). vazul: An R package for analysis blinding. Zenodo. https://doi.org/10.5281/zenodo.18269711

License

MIT License - see LICENSE file for details.

Metadata

Version

1.1.0

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows