Skip to content

Commit

Permalink
update for cran check
Browse files Browse the repository at this point in the history
  • Loading branch information
emitanaka committed Nov 12, 2023
1 parent bdb85e8 commit 3bbd04e
Show file tree
Hide file tree
Showing 23 changed files with 362 additions and 346 deletions.
2 changes: 1 addition & 1 deletion R/anatomy.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @param ... Any other arguments parsed to `dae::designAnatomy`.
#' @examples
#' split <- takeout(menu_split(t1 = 3, t2 = 2, r = 2))
#' anatomy(split)
#' design_anatomy(split)
#' @return An object of class "des_anatomy".
#' @export
design_anatomy <- function(.edibble, ...) {
Expand Down
6 changes: 3 additions & 3 deletions R/assign.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ assign_trts <- function(.edibble, order = "random", seed = NULL, constrain = nes
vanc <- prov$fct_id_ancestor(id = unit_id, role = "edbl_unit")
units_df_with_id <- units_df <- tibble::as_tibble(prov$serve_units(id = vanc))
units_df_with_id$..id.. <- 1:nrow(units_df_with_id)
ptrts_df <- na.omit(tibble::as_tibble(prov$serve_trts(id = parent_trts)))
ptrts_df <- stats::na.omit(tibble::as_tibble(prov$serve_trts(id = parent_trts)))

if(nrow(ptrts_df) == 0L) abort(paste0("The treatment factor, ",
.combine_words(prov$fct_names(id = trts_id), fun = cli::col_blue),
Expand Down Expand Up @@ -104,7 +104,7 @@ assign_trts <- function(.edibble, order = "random", seed = NULL, constrain = nes
{
vparents <- prov$fct_id(name = constrain[[unit_nm]])
order_name <- structure(order[igroup], class = order[igroup])
order_trts(order_name, trts_table = sub_trts_df, units_table = sub_units_df, unit = setNames(unit_id, unit_nm), constrain = vparents, Provenance = prov, ...)
order_trts(order_name, trts_table = sub_trts_df, units_table = sub_units_df, unit = stats::setNames(unit_id, unit_nm), constrain = vparents, Provenance = prov, ...)
})
permutation[units_df_with_id$..id..[locs]] <- sub_trts_df_with_id[permute, "..id..", drop = TRUE]
}
Expand Down Expand Up @@ -144,7 +144,7 @@ assign_trts <- function(.edibble, order = "random", seed = NULL, constrain = nes
units_df <- tibble::as_tibble(prov$serve_units(id = vanc))
vparents <- prov$fct_id(name = constrain[[unit_nm]])
order_name <- structure(order[igroup], class = order[igroup])
order_trts(order_name, trts_table = trts_df, units_table = units_df, unit = setNames(unit_id, unit_nm), constrain = vparents, Provenance = prov, ...)
order_trts(order_name, trts_table = trts_df, units_table = units_df, unit = stats::setNames(unit_id, unit_nm), constrain = vparents, Provenance = prov, ...)
})

}
Expand Down
1 change: 1 addition & 0 deletions R/attrs.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ fct_attrs <- fct
#'
#'
#' @param value A vector of the level values.
#' @param n The number of replicate (if applicable).
#' @param data A list or data frame of the same size as the `levels`.
#' @param ... Name-value pair denoting other level attributes. The value should be the same
#' length as `levels` or a single value.
Expand Down
2 changes: 1 addition & 1 deletion R/design.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ design_model <- function(data, type = c("anova", "lmer")) {
des <- edbl_design(data)
type <- match.arg(type)
unit_str <- des$anatomy
units <- attr(terms(unit_str), "term.labels")
units <- attr(stats::terms(unit_str), "term.labels")
trts <- map_lgl(prov$fct_levels(name = prov$trt_names(), return = "value"),
function(x) inherits(x, "numeric") | inherits(x, "integer"))
tnames <- names(trts)
Expand Down
2 changes: 0 additions & 2 deletions R/edibble.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ not_edibble <- function(x) {
#' @param ... Passed to `new_tibble`.
#' @param .design An edibble graph object.
#' @param .class Subclasses for edibble table. The default is NULL.
#' @param units The data columns that are units.
#' @param trts The data columns that are treatments.
#' @importFrom tibble new_tibble
#' @importFrom vctrs vec_size_common
#' @return An edibble table.
Expand Down
2 changes: 1 addition & 1 deletion R/latin.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @examples
#' latin_square(n = 3)
#' latin_rectangle(3, 3, 3)
#' latin_array(3, c(3, 3, 3))
#' latin_array(c(3, 3, 3), 3)
NULL

#' @describeIn latin Latin square design
Expand Down
2 changes: 1 addition & 1 deletion R/pivot.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#' @param .remove_empty Remove empty combinations. Default is TRUE.
#' @examples
#' spd <- takeout(menu_split())
#' spd %>% split(trt1)
#' split(spd, spd$trt1)
#' spd %>% split_by(trt1)
#' spd %>% split_by(trt2)
#' spd %>% split_by(mainplot)
Expand Down
6 changes: 3 additions & 3 deletions R/simulate.R
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ get_censored_value <- function(y, valid, censor) {
switch(valid$operator,
"greaterThan" = return_censor_value(y, y > value, censor, valid_env = valid_env),
"greaterThanOrEqual" = return_censor_value(y, y >= value, censor, valid_env = valid_env),
"equal" = return_censor_value(y, y == value, .censor, valid_env = valid_env),
"equal" = return_censor_value(y, y == value, censor, valid_env = valid_env),
"between" = return_censor_value(y, y > value[1] & y < value[2], censor, value, valid_env = valid_env),
"lessThanOrEqual" = return_censor_value(y, y <= value, censor, valid_env = valid_env),
"lessThan" = return_censor_value(y, y < value, censor, valid_env = valid_env))
Expand Down Expand Up @@ -291,7 +291,7 @@ aggregate_values <- function(y, group, fn) {
#' @param .interaction Whether there should be treatment interaction effects.
#' @param .discrete Whether to make the response value discrete or not.
#' @param .linear Whether to include non-linear term or not. The value is always additive.
#' @param .dist The random distribution to use for numerical values
#' @param .error_dist The random distribution to use for numerical values
#' (either "normal", "uniform", "exponential", "gamma", "beta", "cauchy", "chisq", "f", "t", "poisson", "weibull").
#' The default choice is random out of these with higher chances of "normal".
#' @seealso [autofill_rcrds()]
Expand Down Expand Up @@ -506,7 +506,7 @@ examine_process <- function(data, process = NULL) {
NULL
} else {
if(!is_null(process)) {
res <- setNames(list(res), process)
res <- stats::setNames(list(res), process)
}
structure(res, class = c("sim_process", class(res)))
}
Expand Down
25 changes: 23 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
## Release summary

This is a major internal change that the R6 class is completely changed to a Provenance class object that ensures a more consistent and cognitive access to internal structure.
This update makes a number of bug fixes, addition of new features and
quality of life improvements as shown below.

Other changes include the change of dependency to use `openxlsx2` instead of `openxlsx` and the change in print for the object with class `ebdl_table`.
Bug fixes

* Bug fix for export_design when no record factor exists
* Bug fix for order assignment

Quality of life improvements

* Format change for the title page in the export
* Change behaviour of `fct_attrs()` when levels supplied as numeric or vector
instead of `lvls()`.
* Change the print out of edibble table.
* Improve the assignment algorithm.

New features

* Added new functions `count_by()` and `split_by()`.
* Added ability to specify conditional treatment.
* The `simuluate_rcrds()` has now a facelift with delineation of the process specification to `simulate_process()`.
* `autofill_rcrds()` implemented.
* Added ability to add two designs by `+`.
* Ability to add metadata through design().

## R CMD check results

Expand Down
2 changes: 1 addition & 1 deletion man/design_anatomy.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/latin.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/lvls.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions man/new_edibble.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/split_by.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/with_variables.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3bbd04e

Please sign in to comment.