From f90f6794ee292fd188cc9c423c01e6fe08805b2d Mon Sep 17 00:00:00 2001 From: Emi Tanaka Date: Sat, 25 Nov 2023 12:49:00 +1100 Subject: [PATCH] fix for allot_table --- R/allot.R | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/R/allot.R b/R/allot.R index ae103e1..36b929d 100644 --- a/R/allot.R +++ b/R/allot.R @@ -29,7 +29,7 @@ allot_trts <- function(.edibble = NULL, ..., .record = TRUE) { ncl <- length(cl) cl[3:(ncl + 1)] <- cl[2:ncl] cl$.edibble <- NULL - return(structure(cl, class = "edbl_fn")) + return(structure(cl, class = c("edbl_fn", "edbl"))) } dots <- list2(...) not_edibble(.edibble) @@ -159,8 +159,15 @@ allot_units <- function(.edibble, ..., .record = TRUE) { #' @inheritParams assign_fcts #' #' @export -allot_table <- function(.edibble, ..., order = "random", seed = NULL, constrain = nesting_structure(.edibble), label_nested = NULL, fail = "error", .record = TRUE) { +allot_table <- function(.edibble = NULL, ..., order = "random", seed = NULL, constrain = nesting_structure(.edibble), label_nested = NULL, fail = "error", .record = TRUE) { if(is.null(.edibble)) return(structure(match.call(), class = c("edbl_fn", "edbl"))) + if(is_formula(.edibble)) { + cl <- match.call() + ncl <- length(cl) + cl[3:(ncl + 1)] <- cl[2:ncl] + cl$.edibble <- NULL + return(structure(cl, class = c("edbl_fn", "edbl"))) + } prov <- activate_provenance(.edibble) if(.record) prov$record_step() .edibble %>%