Skip to content

Commit

Permalink
Merge pull request #36 from bedapub/chore/cran-submission
Browse files Browse the repository at this point in the history
Fixes to prepare for CRAN submission
  • Loading branch information
idavydov committed Feb 20, 2024
2 parents b9f6c60 + 16564a8 commit aef2781
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 148 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
^renv$
^renv\.lock$
^designit\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
Expand All @@ -19,3 +21,5 @@

# vignette cache
^vignettes/cached/.*\.Rmd$
# large vignette excluded on CRAN
^vignettes/plate_scoring_examples.Rmd$
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ Suggests:
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
VignetteBuilder: knitr
biocViews:
16 changes: 1 addition & 15 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export(.data)
export(BatchContainer)
export(BatchContainerDimension)
export(L1_norm)
export(L2s_norm)
export(accept_leftmost_improvement)
export(as_label)
export(as_name)
export(assign_from_table)
export(assign_in_order)
export(assign_random)
export(batch_container_from_table)
export(compile_possible_subgroup_allocation)
export(complete_random_shuffling)
export(drop_order)
export(enquo)
export(enquos)
export(expr)
export(first_score_only)
export(form_homogeneous_subgroups)
export(generate_terms)
Expand All @@ -38,16 +32,8 @@ export(shuffle_grouped_data)
export(shuffle_with_constraints)
export(shuffle_with_subgroup_formation)
export(sum_scores)
export(sym)
export(syms)
export(worst_score)
import(R6, except = getNamespaceExports("R6"))
importFrom(magrittr,"%>%")
importFrom(rlang,.data)
importFrom(rlang,as_label)
importFrom(rlang,as_name)
importFrom(rlang,enquo)
importFrom(rlang,enquos)
importFrom(rlang,expr)
importFrom(rlang,sym)
importFrom(rlang,syms)
importFrom(stats,na.omit)
4 changes: 2 additions & 2 deletions R/assignment.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ assign_in_order <- function(batch_container, samples = NULL) {
#'
#' @example man/examples/shuffle_with_constraints.R
shuffle_with_constraints <- function(src = TRUE, dst = TRUE) {
src <- enquo(src)
dst <- enquo(dst)
src <- rlang::enquo(src)
dst <- rlang::enquo(dst)
function(bc, i) {
dt <- bc$get_samples(include_id = TRUE, as_tibble = FALSE)
src_ind <- which(rep_len(TRUE, nrow(dt)) & rlang::eval_tidy(src, dt))
Expand Down
1 change: 1 addition & 0 deletions R/batch_container.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ locations_table_from_dimensions <- function(dimensions, exclude) {
#' A typical workflow starts with creating a `BatchContainer`. Then
#' samples can be assigned to locations in that container.
#'
#' @rawNamespace import(R6, except = getNamespaceExports("R6"))
#' @export
BatchContainer <- R6::R6Class("BatchContainer",
public = list(
Expand Down
4 changes: 4 additions & 0 deletions R/designit-package.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#' @keywords internal
"_PACKAGE"

# Manual imports
#' @importFrom rlang .data
NULL

# The following block is used by usethis to automatically manage
# roxygen namespace tags. Modify with care!
## usethis namespace: start
Expand Down
4 changes: 2 additions & 2 deletions R/randomization.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ getScore <- function(layout, balance, sc_groups, sc_tests,
# get the penalty for each dimension group
# factor von balace variables
penalty <- layout %>%
dplyr::group_by(!!sym(group)) %>%
dplyr::group_by(!!rlang::sym(group)) %>%
dplyr::summarize_at(.vars = dplyr::vars(balance), testFun)
score <- penalty %>%
dplyr::summarize(score = sum((!!sym(balance))^2, na.rm = TRUE))
dplyr::summarize(score = sum((!!rlang::sym(balance))^2, na.rm = TRUE))
score <- sum(score * bal_weights) # multiply score for each balance factor by its weight and sum
tscore <- tscore + score
} else {
Expand Down
16 changes: 8 additions & 8 deletions R/utils-datatable.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#' This undocumented (?) flag allows us to use `:=`
#' without getting an error.
#' @keywords internal
#' Show that the package is designed to rely on data.table functionality
#'
#' See [data.table::let()] and
#' [`vignette("datatable-importing", "data.table")`](https://cran.r-project.org/web/packages/data.table/vignettes/datatable-importing.html)
#' section "data.table in Imports but nothing imported".
#'
#' @examples
#' \dontrun{
#' dt <- data.table::data.table(a = 1, b = 2)
#' dt[, a := NULL]
#' }
#' @keywords internal
#' @usage NULL
#' @format NULL
.datatable.aware <- TRUE
47 changes: 0 additions & 47 deletions R/utils-tidy-eval.R

This file was deleted.

2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ devtools::install_github("BEDApub/designit")
## Usage

### R in Pharma presentation
[![Designit: a flexible engine to generate experiment layouts, R in Pharma presentation](https://img.youtube.com/vi/mvPmSQJVy8o/0.jpg)](http://www.youtube.com/watch?v=mvPmSQJVy8o "Designit: a flexible engine to generate experiment layouts")
[![Designit: a flexible engine to generate experiment layouts, R in Pharma presentation](https://img.youtube.com/vi/mvPmSQJVy8o/0.jpg)](https://www.youtube.com/watch?v=mvPmSQJVy8o "Designit: a flexible engine to generate experiment layouts")

### Batch container
The main class used is `BatchContainer`, which holds the dimensions for sample allocation.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ devtools::install_github("BEDApub/designit")
## Usage

### R in Pharma presentation
[![Designit: a flexible engine to generate experiment layouts, R in Pharma presentation](https://img.youtube.com/vi/mvPmSQJVy8o/0.jpg)](http://www.youtube.com/watch?v=mvPmSQJVy8o "Designit: a flexible engine to generate experiment layouts")
[![Designit: a flexible engine to generate experiment layouts, R in Pharma presentation](https://img.youtube.com/vi/mvPmSQJVy8o/0.jpg)](https://www.youtube.com/watch?v=mvPmSQJVy8o "Designit: a flexible engine to generate experiment layouts")

### Batch container
The main class used is `BatchContainer`, which holds the dimensions for
Expand Down
20 changes: 4 additions & 16 deletions man/dot-datatable.aware.Rd

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

50 changes: 0 additions & 50 deletions man/tidyeval.Rd

This file was deleted.

10 changes: 5 additions & 5 deletions vignettes/plate_layouts.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ cowplot::plot_grid(
)
```

```{r fig.width=9, fig.height=3}
```{r fig.width=5.5, fig.height=2}
bc$scores_table() |>
ggplot(aes(step, value, color = score)) +
geom_line() +
Expand Down Expand Up @@ -398,7 +398,7 @@ scoring_f <- list(
bc <- assign_random(bc, subjects)
```

```{r, fig.width= 8, fig.height=3}
```{r, fig.width= 5, fig.height=2}
cowplot::plot_grid(
plotlist = list(
bc$get_samples() %>% ggplot(aes(x = plate, fill = Group)) +
Expand Down Expand Up @@ -495,7 +495,7 @@ bc$get_samples() %>%
unlist()
```

```{r, fig.width= 8, fig.height=10}
```{r, fig.width= 5, fig.height=6.25}
cowplot::plot_grid(
plotlist = list(
plot_plate(bc,
Expand Down Expand Up @@ -533,7 +533,7 @@ bc <- optimize_multi_plate_design(bc,
)
```

```{r, fig.width= 8, fig.height=10}
```{r, fig.width= 5, fig.height=6.25}
cowplot::plot_grid(
plotlist = list(
plot_plate(bc,
Expand All @@ -555,7 +555,7 @@ cowplot::plot_grid(
```


```{r fig.width=6, fig.height=5}
```{r fig.width=6, fig.height=4}
bc$scores_table() |>
ggplot(aes(step, value, color = score)) +
geom_line() +
Expand Down

0 comments on commit aef2781

Please sign in to comment.