muddle {cheese}R Documentation

Randomly permute some or all columns of a data frame

Description

Shuffle any of the columns of a data.frame to artificially distort relationships.

Usage

muddle(
    data,
    at,
    ...
)

Arguments

data

A data.frame.

at

A vector of quoted/unquoted columns, positions, and/or tidyselect::select_helpers. Defaults to all columns.

...

Additional arguments passed to sample.

Value

A tibble::tibble

Author(s)

Alex Zajichek

Examples

#Set a seed
set.seed(123)

#Default permutes all columns
heart_disease %>%
  muddle

#Permute select columns
heart_disease %>%
  muddle(
    at = c(Age, Sex)
  )

#Using a select helper
heart_disease %>%
  muddle(
    at = matches("^S")
  )

#Pass other arguments
heart_disease %>%
  muddle(
    size = 5,
    replace = TRUE
  )


[Package cheese version 0.1.2 Index]