Flexible dummy-coding allowing for all R's built-in types of contrasts and optional dropping of a factor level to reduce rank defficiency probability.
Examples
vec <- c("a","a","b","b","c","c")
dummycode(vec)
#> x1 x2
#> 1 1 0
#> 2 1 0
#> 3 0 1
#> 4 0 1
#> 5 -1 -1
#> 6 -1 -1