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

export not working #73

Open emitanaka opened 1 month ago

emitanaka commented 1 month ago

library(edibble)
library(tidyverse)
des <- design("Nodule development study") |> 
  set_units(tray = 7,
            col = nested_in(tray, 2),
            row = nested_in(tray, 12),
            plate = nested_in(tray, crossed_by(col, row))) |> 
  set_trts(sampling_points = as.character(c(0, 3, 7, 14, 21)),
           genotype = 6) |> 
  allot_table(sampling_points:genotype ~ plate, order = "blocksdesign", label_nested = c(row, col))

des |> 
  set_rcrds(nodule_number = plate,
            y = plate) |> 
  expect_rcrds(nodule_number >= 0L, 
               factor(y, levels = c("yes", "no"))) |> 
  export_design("mydesign.xlsx")

deggust::autoplot(des, nfill_max = Inf)

des |> 
  count(genotype, sampling_points) |> 
  print(n = Inf)

des |> 
  ggplot(aes(col, row)) + 
  geom_tile(color = "black", aes(fill = genotype)) +
  geom_text(aes(label = sampling_points)) + 
  facet_wrap(~tray, scale = "free")