This function uses treatment combinations in standard (Yates') order to generate factors canonical format for factorial designs with only two levels.
treatcomb2factors(data)
the updated data with factors in the canonical format
library(planex)
data(refrigerantes2k)
head(refrigerantes2k)
#> comb_trat pontuacao
#> 1 (1) 159
#> 2 a 168
#> 3 b 158
#> 4 ab 166
#> 5 c 175
#> 6 ac 179
refrigerantes2k <- treatcomb2factors(refrigerantes2k)
refrigerantes2k
#> comb_trat pontuacao A B C D
#> 1 (1) 159 -1 -1 -1 -1
#> 2 a 168 1 -1 -1 -1
#> 3 b 158 -1 1 -1 -1
#> 4 ab 166 1 1 -1 -1
#> 5 c 175 -1 -1 1 -1
#> 6 ac 179 1 -1 1 -1
#> 7 bc 173 -1 1 1 -1
#> 8 abc 179 1 1 1 -1
#> 9 d 164 -1 -1 -1 1
#> 10 ad 187 1 -1 -1 1
#> 11 bd 163 -1 1 -1 1
#> 12 abd 185 1 1 -1 1
#> 13 cd 168 -1 -1 1 1
#> 14 acd 197 1 -1 1 1
#> 15 bcd 170 -1 1 1 1
#> 16 abcd 194 1 1 1 1
#> 17 (1) 163 -1 -1 -1 -1
#> 18 a 175 1 -1 -1 -1
#> 19 b 163 -1 1 -1 -1
#> 20 ab 168 1 1 -1 -1
#> 21 c 178 -1 -1 1 -1
#> 22 ac 183 1 -1 1 -1
#> 23 bc 168 -1 1 1 -1
#> 24 abc 182 1 1 1 -1
#> 25 d 159 -1 -1 -1 1
#> 26 ad 189 1 -1 -1 1
#> 27 bd 159 -1 1 -1 1
#> 28 abd 191 1 1 -1 1
#> 29 cd 174 -1 -1 1 1
#> 30 acd 199 1 -1 1 1
#> 31 bcd 174 -1 1 1 1
#> 32 abcd 198 1 1 1 1