Skip to contents

Pivot treatments to a wider list or table format

Usage

pivot_trts_widelist(.data, trts = NULL, fcts = NULL, drop = FALSE)

pivot_trts_widetable(.data, trts = NULL, fcts = NULL)

Arguments

.data

An edibble table.

trts

A vector of treatment (tidyselect compatible). By default it is NULL and includes all the treatments.

fcts

A vector of factors in the edibble table.

drop

Whether the resulting list should drop to a vector within each list element if there is only one column. Default is FALSE.

Value

A named list where elements are the data and the names are treatments.

Examples

pivot_trts_widelist(takeout(menu_crd(t = 5, n = 20)))
#> Warning: `pivot_trts_widelist()` was deprecated in edibble 1.1.0.
#>  Please use `pivot_trts()` instead.
#> $trt1
#>      unit
#> 10 unit10
#> 16 unit16
#> 19 unit19
#> 20 unit20
#> 
#> $trt2
#>      unit
#> 3  unit03
#> 6  unit06
#> 7  unit07
#> 13 unit13
#> 
#> $trt3
#>      unit
#> 1  unit01
#> 2  unit02
#> 12 unit12
#> 15 unit15
#> 
#> $trt4
#>      unit
#> 5  unit05
#> 9  unit09
#> 11 unit11
#> 17 unit17
#> 
#> $trt5
#>      unit
#> 4  unit04
#> 8  unit08
#> 14 unit14
#> 18 unit18
#>