Skip to content

Commit

Permalink
Merge pull request #4 from abichat/dev
Browse files Browse the repository at this point in the history
v0.0.2
  • Loading branch information
abichat authored Jun 7, 2024
2 parents 847b481 + 84ae56d commit 00934c9
Show file tree
Hide file tree
Showing 44 changed files with 623 additions and 112 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/R-CMD-check-prdev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
extra-packages: |
any::rcmdcheck
yatah
needs: check

- uses: r-lib/actions/check-r-package@v2
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
extra-packages: |
any::rcmdcheck
yatah
needs: check

- uses: r-lib/actions/check-r-package@v2
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
extra-packages: |
any::pkgdown
local::.
yatah
needs: website

- name: Build site
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
.quarto
inst/doc
docs
pkgdown
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: scimo
Title: Extra Recipes Steps for Dealing with Omics Data
Version: 0.0.1
Version: 0.0.2
Authors@R: c(
person("Antoine", "BICHAT", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-6599-7081")),
Expand Down
19 changes: 17 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,54 @@ S3method(bake,step_select_background)
S3method(bake,step_select_cv)
S3method(bake,step_select_kruskal)
S3method(bake,step_select_wilcoxon)
S3method(bake,step_taxonomy)
S3method(prep,step_aggregate_hclust)
S3method(prep,step_aggregate_list)
S3method(prep,step_rownormalize_tss)
S3method(prep,step_select_background)
S3method(prep,step_select_cv)
S3method(prep,step_select_kruskal)
S3method(prep,step_select_wilcoxon)
S3method(prep,step_taxonomy)
S3method(print,step_aggregate_hclust)
S3method(print,step_aggregate_list)
S3method(print,step_rownormalize_tss)
S3method(print,step_select_background)
S3method(print,step_select_cv)
S3method(print,step_select_kruskal)
S3method(print,step_select_wilcoxon)
S3method(print,step_taxonomy)
S3method(required_pkgs,step_aggregate_hclust)
S3method(required_pkgs,step_aggregate_list)
S3method(required_pkgs,step_rownormalize_tss)
S3method(required_pkgs,step_select_background)
S3method(required_pkgs,step_select_cv)
S3method(required_pkgs,step_select_kruskal)
S3method(required_pkgs,step_select_wilcoxon)
S3method(required_pkgs,step_taxonomy)
S3method(tidy,step_aggregate_hclust)
S3method(tidy,step_aggregate_list)
S3method(tidy,step_rownormalize_tss)
S3method(tidy,step_select_background)
S3method(tidy,step_select_cv)
S3method(tidy,step_select_kruskal)
S3method(tidy,step_select_wilcoxon)
S3method(tidy,step_taxonomy)
export("%>%")
export(cv)
export(step_aggregate_hclust)
export(step_aggregate_list)
export(step_rownormalize_tss)
export(step_select_background)
export(step_select_cv)
export(step_select_kruskal)
export(step_select_wilcoxon)
export(var_to_keep)
export(step_taxonomy)
importFrom(dplyr,filter)
importFrom(dplyr,if_else)
importFrom(dplyr,left_join)
importFrom(dplyr,mutate)
importFrom(dplyr,pull)
importFrom(generics,required_pkgs)
importFrom(generics,tidy)
importFrom(magrittr,"%>%")
importFrom(recipes,add_step)
Expand All @@ -59,7 +71,9 @@ importFrom(recipes,step)
importFrom(rlang,.data)
importFrom(rlang,.env)
importFrom(rlang,abort)
importFrom(rlang,call2)
importFrom(rlang,enquos)
importFrom(rlang,eval_tidy)
importFrom(stats,as.formula)
importFrom(stats,cutree)
importFrom(stats,dist)
Expand All @@ -70,4 +84,5 @@ importFrom(stats,sd)
importFrom(stats,wilcox.test)
importFrom(tibble,enframe)
importFrom(tibble,tibble)
importFrom(tidyr,expand_grid)
importFrom(tidyr,unnest_longer)
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# scimo 0.0.2

* New function `step_taxonomy()`.

* Replace superseded `juice()` with `bake(new_data = NULL)` to align with current practices (#1).


# scimo 0.0.1

* First release of **scimo**.
9 changes: 8 additions & 1 deletion R/aggregate_hclust.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#' prep()
#' rec
#' tidy(rec, 1)
#' juice(rec)
#' bake(rec, new_data = NULL)
step_aggregate_hclust <- function(recipe, ..., role = "predictor",
trained = FALSE,
n_clusters,
Expand Down Expand Up @@ -200,3 +200,10 @@ tidy.step_aggregate_hclust <- function(x, ...) {
res$id <- x$id
res
}


#' @rdname required_pkgs.scimo
#' @export
required_pkgs.step_aggregate_hclust <- function(x, ...) {
c("scimo")
}
19 changes: 13 additions & 6 deletions R/aggregate_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
#' have been estimated.
#' @param list_agg Named list of aggregated variables.
#' @param fun_agg Aggregation function like `sum` or `mean`.
#' @param others Behavior for the selected variables in `...` that are not present in
#' `list_agg`. If `discard` (the default), they are not kept. If `asis`, they
#' are kept without modification. If `aggregate`, they are aggregated in a
#' new variable.
#' @param others Behavior for the selected variables in `...` that are not
#' present in `list_agg`. If `discard` (the default), they are not kept.
#' If `asis`, they are kept without modification. If `aggregate`, they are
#' aggregated in a new variable.
#' @param name_others If `others` is set to `aggregate`, name of the
#' aggregated variable. Not used otherwise.
#' @param res This parameter is only produced after the recipe has been trained.
Expand Down Expand Up @@ -53,7 +53,7 @@
#' prep()
#' rec
#' tidy(rec, 1)
#' juice(rec)
#' bake(rec, new_data = NULL)
step_aggregate_list <- function(recipe, ..., role = "predictor",
trained = FALSE,
list_agg = NULL,
Expand Down Expand Up @@ -87,7 +87,7 @@ step_aggregate_list <- function(recipe, ..., role = "predictor",

#' @importFrom recipes step
step_aggregate_list_new <- function(terms, role, trained,
list_agg, fun_agg, others,name_others,
list_agg, fun_agg, others, name_others,
res, prefix, keep_original_cols,
skip, id) {

Expand Down Expand Up @@ -224,3 +224,10 @@ tidy.step_aggregate_list <- function(x, ...) {
res$id <- x$id
res
}


#' @rdname required_pkgs.scimo
#' @export
required_pkgs.step_aggregate_list <- function(x, ...) {
c("scimo")
}
10 changes: 10 additions & 0 deletions R/checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ check_binary <- function(x, name_x = "x") {

invisible(x)
}


check_not_null <- function(x, name_x = "x") {
if (is.null(x)) {
rlang::abort(paste0("`", name_x,
"` must be specified and can't be `NULL`."))
}

invisible(x)
}
8 changes: 7 additions & 1 deletion R/rownormalize_tss.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#' prep()
#' rec
#' tidy(rec, 1)
#' juice(rec)
#' bake(rec, new_data = NULL)
step_rownormalize_tss <- function(recipe, ..., role = NA, trained = FALSE,
res = NULL, skip = FALSE,
id = rand_id("rownormalize_tss")) {
Expand Down Expand Up @@ -135,3 +135,9 @@ tidy.step_rownormalize_tss <- function(x, ...) {
res
}


#' @rdname required_pkgs.scimo
#' @export
required_pkgs.step_rownormalize_tss <- function(x, ...) {
c("scimo")
}
2 changes: 1 addition & 1 deletion R/scimo-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"_PACKAGE"

## usethis namespace: start
#' @importFrom generics tidy
#' @importFrom generics required_pkgs tidy
#' @importFrom recipes prep bake
#' @importFrom tibble tibble
## usethis namespace: end
Expand Down
9 changes: 8 additions & 1 deletion R/select_background.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#' prep()
#' rec
#' tidy(rec, 1)
#' juice(rec)
#' bake(rec, new_data = NULL)
step_select_background <- function(recipe, ..., role = NA, trained = FALSE,
background_level = NULL,
n_samples = NULL,
Expand Down Expand Up @@ -184,3 +184,10 @@ tidy.step_select_background <- function(x, ...) {
res$id <- x$id
res
}


#' @rdname required_pkgs.scimo
#' @export
required_pkgs.step_select_background <- function(x, ...) {
c("scimo")
}
13 changes: 10 additions & 3 deletions R/select_cv.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
#' before the computation proceeds. Default to `TRUE`.
#'
#' @return The coefficient of variation of `x`.
#' @export
#'
#' @importFrom stats sd
#'
#' @author Antoine Bichat
#'
#' @keywords internal
#'
#' @examples
#' cv(1:10)
#' scimo:::cv(1:10)
cv <- function(x, na.rm = TRUE) {
sd(x, na.rm = na.rm) / abs(mean(x, na.rm = na.rm))
}
Expand Down Expand Up @@ -59,7 +60,7 @@ cv <- function(x, na.rm = TRUE) {
#' prep()
#' rec
#' tidy(rec, 1)
#' juice(rec)
#' bake(rec, new_data = NULL)
step_select_cv <- function(recipe, ..., role = NA, trained = FALSE,
n_kept = NULL,
prop_kept = NULL,
Expand Down Expand Up @@ -187,3 +188,9 @@ tidy.step_select_cv <- function(x, ...) {
res
}


#' @rdname required_pkgs.scimo
#' @export
required_pkgs.step_select_cv <- function(x, ...) {
c("scimo")
}
9 changes: 8 additions & 1 deletion R/select_kruskal.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' prep()
#' rec
#' tidy(rec, 1)
#' juice(rec)
#' bake(rec, new_data = NULL)
step_select_kruskal <- function(recipe, ..., role = NA, trained = FALSE,
outcome = NULL,
n_kept = NULL,
Expand Down Expand Up @@ -179,3 +179,10 @@ tidy.step_select_kruskal <- function(x, ...) {
res$id <- x$id
res
}


#' @rdname required_pkgs.scimo
#' @export
required_pkgs.step_select_kruskal <- function(x, ...) {
c("scimo")
}
9 changes: 8 additions & 1 deletion R/select_wilcoxon.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#' prep()
#' rec
#' tidy(rec, 1)
#' juice(rec)
#' bake(rec, new_data = NULL)
step_select_wilcoxon <- function(recipe, ..., role = NA, trained = FALSE,
outcome = NULL,
n_kept = NULL,
Expand Down Expand Up @@ -199,3 +199,10 @@ tidy.step_select_wilcoxon <- function(x, ...) {
res$id <- x$id
res
}


#' @rdname required_pkgs.scimo
#' @export
required_pkgs.step_select_wilcoxon <- function(x, ...) {
c("scimo")
}
Loading

0 comments on commit 00934c9

Please sign in to comment.