permute_df() permutes a data set: it randomizes the order within each variable, which breaks any association between them. Permutation is useful for testing against null statistics.

permute_df(.data)

Arguments

.data

a data.frame

Value

a permuted data.frame

Examples

permute_df(iris)
#> # A tibble: 150 × 5
#>    Sepal.Length Sepal.Width Petal.Length Petal.Width Species   
#>           <dbl>       <dbl>        <dbl>       <dbl> <fct>     
#>  1          5.2         3.3          5.5         0.3 versicolor
#>  2          6.3         2.8          5.2         1.8 virginica 
#>  3          4.8         3            5.3         0.1 virginica 
#>  4          6.3         3            5.1         2.4 virginica 
#>  5          5           3            6.1         0.4 setosa    
#>  6          6.5         3.8          5.1         1.3 setosa    
#>  7          6.1         3.2          4.2         2.1 virginica 
#>  8          6.7         4            1.7         0.4 setosa    
#>  9          4.6         2.4          5.8         1   versicolor
#> 10          7.2         3            3.8         1.4 virginica 
#> # ℹ 140 more rows