Skip to content

Commit

Permalink
fix issue where more than one nesting unit with no crossing unit
Browse files Browse the repository at this point in the history
  • Loading branch information
emitanaka committed Nov 11, 2023
1 parent 8314d1d commit 5d3b413
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/assign.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,13 @@ assign_trts <- function(.edibble, order = "random", seed = NULL, constrain = nes
permute_parent_one_alg(vparents, units_df, ntrts)
} else {
vnparents <- prov$fct_id_parent(id = unit_id, role = "edbl_unit", type = "nest")
permute_parent_more_than_one(setdiff(vparents, vnparents), units_df, ntrts, nparents = vnparents)
vcparents <- setdiff(vparents, vnparents)
if(length(vcparents)) {
permute_parent_more_than_one(setdiff(vparents, vnparents), units_df, ntrts, nparents = vnparents)
} else {
units_df$`0` <- do.call(paste, units_df[as.character(vnparents)])
permute_parent_one_alg(0, units_df, ntrts)
}
}
}
},
Expand Down

0 comments on commit 5d3b413

Please sign in to comment.