Randomize a Dataframe

randomize(data)

Arguments

data

A dataframe or tibble.

Examples

library(tidyverse) test_data <- tibble( Group = sample(c("Apple", "Pear"), size = 10, replace = TRUE), A = sample(c(NA_integer_, 1:3), size = 10, replace = TRUE), B = sample(c(NA_integer_, 4:6), size = 10, replace = TRUE) ) randomize(test_data)
#> # A tibble: 10 x 3 #> Group A B #> <chr> <int> <int> #> 1 Apple 1 4 #> 2 Pear 1 NA #> 3 Apple NA NA #> 4 Pear 3 NA #> 5 Pear 3 4 #> 6 Apple NA 5 #> 7 Apple NA 6 #> 8 Apple 1 NA #> 9 Pear 3 4 #> 10 Apple 2 6