Arguments
- dat
NO DEFAULT. A list of vectors that you wish to switch/invert
Value
Returns a data.table of the switched/inverted li
Examples
lst <- list("A" = c(1,2,3), "B" = c(4,5,6), "C" = c(7,8,9))
lst
#> $A
#> [1] 1 2 3
#>
#> $B
#> [1] 4 5 6
#>
#> $C
#> [1] 7 8 9
#>
res <- do.list.switch(lst)
res
#> Values New
#> <num> <char>
#> 1: 1 A
#> 2: 2 A
#> 3: 3 A
#> 4: 4 B
#> 5: 5 B
#> 6: 6 B
#> 7: 7 C
#> 8: 8 C
#> 9: 9 C