emitanaka / edibble

An R-package that encapsulate elements of experimental design for better planning, management, and workflow
https://edibble.emitanaka.org
Other
215 stars 14 forks source link

Revamping internal data representation #55

Closed emitanaka closed 1 year ago

emitanaka commented 1 year ago
library(edibble)
set.seed(1)
des <- attr(takeout(menu_lsd(t = 2)), "design")
des$graph$nodes
#>   id name     class
#> 1  1  row edbl_unit
#> 2  2  col edbl_unit
#> 3  3 unit edbl_unit
#> 4  4  trt  edbl_trt
des$graph$edges
#>    from to alloc  type var_from var_to
#> 1     1  3    NA  nest      row   unit
#> 2     2  3    NA  nest      col   unit
#> 21    2  1    NA cross      col    row
#> 3     1  2    NA cross      row    col
#> 11    4  3     1 allot     <NA>   <NA>
des$graph$levels$nodes
#>    idvar id  name  var label
#> 1      1  1  row1  row  row1
#> 2      1  2  row2  row  row2
#> 3      2  3  col1  col  col1
#> 4      2  4  col2  col  col2
#> 5      3  5 unit1 unit unit1
#> 6      3  6 unit2 unit unit2
#> 7      3  7 unit3 unit unit3
#> 8      3  8 unit4 unit unit4
#> 9      4  9  trt1  trt  trt1
#> 10     4 10  trt2  trt  trt2
des$graph$levels$edges
#>    from to alloc type lvl_from lvl_to
#> 1     1  5    NA   NA     row1  unit1
#> 2     2  6    NA   NA     row2  unit2
#> 3     1  7    NA   NA     row1  unit3
#> 4     2  8    NA   NA     row2  unit4
#> 5     3  5    NA   NA     col1  unit1
#> 6     3  6    NA   NA     col1  unit2
#> 7     4  7    NA   NA     col2  unit3
#> 8     4  8    NA   NA     col2  unit4
#> 9    10  5     1   NA     <NA>   <NA>
#> 10    9  6     1   NA     <NA>   <NA>
#> 11    9  7     1   NA     <NA>   <NA>
#> 12   10  8     1   NA     <NA>   <NA>

plot(des)
Screenshot 2023-06-15 at 11 52 47 am

Created on 2023-06-15 with reprex v2.0.2

emitanaka commented 1 year ago

updated in new internals