Skip to contents

Creates a workbook with a config tab, a packed design tab, and diagnostics tabs from a cjtd_design object.

Usage

cjtd_design_render(design)

Arguments

design

A cjtd_design object returned by cjtd_generate_design().

Value

An openxlsx workbook object.

Examples

# Full generation workflow from the README example.
if (FALSE) { # \dontrun{
cfg <- cjtd_design_config(
  attributes = list(
    brand = c("A", "B", "C", "D"),
    price = c("very_high", "high", "mid", "low", "very_low"),
    f1 = c("off", "on"),
    f2 = c("off", "on"),
    f3 = c("off", "on")
  ),
  n_tasks = 10,
  n_alternatives = 3,
  n_versions = 2
)

cfg <- cjtd_forbid_pairs(
  cfg,
  attr_a = "brand",
  levels_a = "A",
  attr_b = "price",
  levels_b = "very_low"
)

cfg <- cjtd_require_n_selected(
  cfg,
  selected = list(
    f1 = "on",
    f2 = "on",
    f3 = "on"
  ),
  n = 1:2
)

example_cjt_design <- cjtd_generate_design(cfg)
} # }

wb <- cjtd_design_render(example_cjt_design)
wb
#> A Workbook object.
#>  
#> Worksheets:
#>  Sheet 1: "config"
#>  
#> 	Custom column widths (column: width)
#> 	  1: 29, 2: 11, 3: 10, 4: 11 
#>  
#> 
#>  Sheet 2: "design"
#>  
#> 	Custom column widths (column: width)
#> 	  1: 11, 2: 8, 3: 6, 4: 10, 5: 11, 6: 5, 7: 5, 8: 5 
#>  
#> 
#>  Sheet 3: "diagnostics_1d"
#>  
#> 	Custom column widths (column: width)
#> 	  1: 13, 2: 12, 3: 15, 4: 33, 5: 17, 6: 13, 7: 17, 8: 13, 9: 18 
#>  
#> 
#>  Sheet 4: "diagnostics_2d"
#>  
#> 	Custom column widths (column: width)
#> 	  1: 15, 2: 10, 3: 15, 4: 15, 5: 17, 6: 13, 7: 17, 8: 13, 9: 18 
#>  
#> 
#>  
#>  Worksheet write order: 1, 2, 3, 4
#>  Active Sheet 1: "config" 
#> 	Position: 1
#>