Skip to content

Commit 00934c9

Browse files
authored
Merge pull request #4 from abichat/dev
v0.0.2
2 parents 847b481 + 84ae56d commit 00934c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+623
-112
lines changed

.github/workflows/R-CMD-check-prdev.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ jobs:
2323

2424
- uses: r-lib/actions/setup-r-dependencies@v2
2525
with:
26-
extra-packages: any::rcmdcheck
26+
extra-packages: |
27+
any::rcmdcheck
28+
yatah
2729
needs: check
2830

2931
- uses: r-lib/actions/check-r-package@v2

.github/workflows/R-CMD-check.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ jobs:
4141

4242
- uses: r-lib/actions/setup-r-dependencies@v2
4343
with:
44-
extra-packages: any::rcmdcheck
44+
extra-packages: |
45+
any::rcmdcheck
46+
yatah
4547
needs: check
4648

4749
- uses: r-lib/actions/check-r-package@v2

.github/workflows/pkgdown.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ jobs:
3232

3333
- uses: r-lib/actions/setup-r-dependencies@v2
3434
with:
35-
extra-packages: any::pkgdown, local::.
35+
extra-packages: |
36+
any::pkgdown
37+
local::.
38+
yatah
3639
needs: website
3740

3841
- name: Build site

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
.quarto
77
inst/doc
88
docs
9+
pkgdown

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: scimo
22
Title: Extra Recipes Steps for Dealing with Omics Data
3-
Version: 0.0.1
3+
Version: 0.0.2
44
Authors@R: c(
55
person("Antoine", "BICHAT", , "[email protected]", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0001-6599-7081")),

NAMESPACE

+17-2
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,54 @@ S3method(bake,step_select_background)
77
S3method(bake,step_select_cv)
88
S3method(bake,step_select_kruskal)
99
S3method(bake,step_select_wilcoxon)
10+
S3method(bake,step_taxonomy)
1011
S3method(prep,step_aggregate_hclust)
1112
S3method(prep,step_aggregate_list)
1213
S3method(prep,step_rownormalize_tss)
1314
S3method(prep,step_select_background)
1415
S3method(prep,step_select_cv)
1516
S3method(prep,step_select_kruskal)
1617
S3method(prep,step_select_wilcoxon)
18+
S3method(prep,step_taxonomy)
1719
S3method(print,step_aggregate_hclust)
1820
S3method(print,step_aggregate_list)
1921
S3method(print,step_rownormalize_tss)
2022
S3method(print,step_select_background)
2123
S3method(print,step_select_cv)
2224
S3method(print,step_select_kruskal)
2325
S3method(print,step_select_wilcoxon)
26+
S3method(print,step_taxonomy)
27+
S3method(required_pkgs,step_aggregate_hclust)
28+
S3method(required_pkgs,step_aggregate_list)
29+
S3method(required_pkgs,step_rownormalize_tss)
30+
S3method(required_pkgs,step_select_background)
31+
S3method(required_pkgs,step_select_cv)
32+
S3method(required_pkgs,step_select_kruskal)
33+
S3method(required_pkgs,step_select_wilcoxon)
34+
S3method(required_pkgs,step_taxonomy)
2435
S3method(tidy,step_aggregate_hclust)
2536
S3method(tidy,step_aggregate_list)
2637
S3method(tidy,step_rownormalize_tss)
2738
S3method(tidy,step_select_background)
2839
S3method(tidy,step_select_cv)
2940
S3method(tidy,step_select_kruskal)
3041
S3method(tidy,step_select_wilcoxon)
42+
S3method(tidy,step_taxonomy)
3143
export("%>%")
32-
export(cv)
3344
export(step_aggregate_hclust)
3445
export(step_aggregate_list)
3546
export(step_rownormalize_tss)
3647
export(step_select_background)
3748
export(step_select_cv)
3849
export(step_select_kruskal)
3950
export(step_select_wilcoxon)
40-
export(var_to_keep)
51+
export(step_taxonomy)
4152
importFrom(dplyr,filter)
4253
importFrom(dplyr,if_else)
4354
importFrom(dplyr,left_join)
4455
importFrom(dplyr,mutate)
4556
importFrom(dplyr,pull)
57+
importFrom(generics,required_pkgs)
4658
importFrom(generics,tidy)
4759
importFrom(magrittr,"%>%")
4860
importFrom(recipes,add_step)
@@ -59,7 +71,9 @@ importFrom(recipes,step)
5971
importFrom(rlang,.data)
6072
importFrom(rlang,.env)
6173
importFrom(rlang,abort)
74+
importFrom(rlang,call2)
6275
importFrom(rlang,enquos)
76+
importFrom(rlang,eval_tidy)
6377
importFrom(stats,as.formula)
6478
importFrom(stats,cutree)
6579
importFrom(stats,dist)
@@ -70,4 +84,5 @@ importFrom(stats,sd)
7084
importFrom(stats,wilcox.test)
7185
importFrom(tibble,enframe)
7286
importFrom(tibble,tibble)
87+
importFrom(tidyr,expand_grid)
7388
importFrom(tidyr,unnest_longer)

NEWS.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# scimo 0.0.2
2+
3+
* New function `step_taxonomy()`.
4+
5+
* Replace superseded `juice()` with `bake(new_data = NULL)` to align with current practices (#1).
6+
7+
18
# scimo 0.0.1
29

310
* First release of **scimo**.

R/aggregate_hclust.R

+8-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
#' prep()
5050
#' rec
5151
#' tidy(rec, 1)
52-
#' juice(rec)
52+
#' bake(rec, new_data = NULL)
5353
step_aggregate_hclust <- function(recipe, ..., role = "predictor",
5454
trained = FALSE,
5555
n_clusters,
@@ -200,3 +200,10 @@ tidy.step_aggregate_hclust <- function(x, ...) {
200200
res$id <- x$id
201201
res
202202
}
203+
204+
205+
#' @rdname required_pkgs.scimo
206+
#' @export
207+
required_pkgs.step_aggregate_hclust <- function(x, ...) {
208+
c("scimo")
209+
}

R/aggregate_list.R

+13-6
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
#' have been estimated.
1414
#' @param list_agg Named list of aggregated variables.
1515
#' @param fun_agg Aggregation function like `sum` or `mean`.
16-
#' @param others Behavior for the selected variables in `...` that are not present in
17-
#' `list_agg`. If `discard` (the default), they are not kept. If `asis`, they
18-
#' are kept without modification. If `aggregate`, they are aggregated in a
19-
#' new variable.
16+
#' @param others Behavior for the selected variables in `...` that are not
17+
#' present in `list_agg`. If `discard` (the default), they are not kept.
18+
#' If `asis`, they are kept without modification. If `aggregate`, they are
19+
#' aggregated in a new variable.
2020
#' @param name_others If `others` is set to `aggregate`, name of the
2121
#' aggregated variable. Not used otherwise.
2222
#' @param res This parameter is only produced after the recipe has been trained.
@@ -53,7 +53,7 @@
5353
#' prep()
5454
#' rec
5555
#' tidy(rec, 1)
56-
#' juice(rec)
56+
#' bake(rec, new_data = NULL)
5757
step_aggregate_list <- function(recipe, ..., role = "predictor",
5858
trained = FALSE,
5959
list_agg = NULL,
@@ -87,7 +87,7 @@ step_aggregate_list <- function(recipe, ..., role = "predictor",
8787

8888
#' @importFrom recipes step
8989
step_aggregate_list_new <- function(terms, role, trained,
90-
list_agg, fun_agg, others,name_others,
90+
list_agg, fun_agg, others, name_others,
9191
res, prefix, keep_original_cols,
9292
skip, id) {
9393

@@ -224,3 +224,10 @@ tidy.step_aggregate_list <- function(x, ...) {
224224
res$id <- x$id
225225
res
226226
}
227+
228+
229+
#' @rdname required_pkgs.scimo
230+
#' @export
231+
required_pkgs.step_aggregate_list <- function(x, ...) {
232+
c("scimo")
233+
}

R/checks.R

+10
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,13 @@ check_binary <- function(x, name_x = "x") {
2222

2323
invisible(x)
2424
}
25+
26+
27+
check_not_null <- function(x, name_x = "x") {
28+
if (is.null(x)) {
29+
rlang::abort(paste0("`", name_x,
30+
"` must be specified and can't be `NULL`."))
31+
}
32+
33+
invisible(x)
34+
}

R/rownormalize_tss.R

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#' prep()
3737
#' rec
3838
#' tidy(rec, 1)
39-
#' juice(rec)
39+
#' bake(rec, new_data = NULL)
4040
step_rownormalize_tss <- function(recipe, ..., role = NA, trained = FALSE,
4141
res = NULL, skip = FALSE,
4242
id = rand_id("rownormalize_tss")) {
@@ -135,3 +135,9 @@ tidy.step_rownormalize_tss <- function(x, ...) {
135135
res
136136
}
137137

138+
139+
#' @rdname required_pkgs.scimo
140+
#' @export
141+
required_pkgs.step_rownormalize_tss <- function(x, ...) {
142+
c("scimo")
143+
}

R/scimo-package.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"_PACKAGE"
33

44
## usethis namespace: start
5-
#' @importFrom generics tidy
5+
#' @importFrom generics required_pkgs tidy
66
#' @importFrom recipes prep bake
77
#' @importFrom tibble tibble
88
## usethis namespace: end

R/select_background.R

+8-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#' prep()
4242
#' rec
4343
#' tidy(rec, 1)
44-
#' juice(rec)
44+
#' bake(rec, new_data = NULL)
4545
step_select_background <- function(recipe, ..., role = NA, trained = FALSE,
4646
background_level = NULL,
4747
n_samples = NULL,
@@ -184,3 +184,10 @@ tidy.step_select_background <- function(x, ...) {
184184
res$id <- x$id
185185
res
186186
}
187+
188+
189+
#' @rdname required_pkgs.scimo
190+
#' @export
191+
required_pkgs.step_select_background <- function(x, ...) {
192+
c("scimo")
193+
}

R/select_cv.R

+10-3
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
#' before the computation proceeds. Default to `TRUE`.
66
#'
77
#' @return The coefficient of variation of `x`.
8-
#' @export
98
#'
109
#' @importFrom stats sd
1110
#'
1211
#' @author Antoine Bichat
1312
#'
13+
#' @keywords internal
14+
#'
1415
#' @examples
15-
#' cv(1:10)
16+
#' scimo:::cv(1:10)
1617
cv <- function(x, na.rm = TRUE) {
1718
sd(x, na.rm = na.rm) / abs(mean(x, na.rm = na.rm))
1819
}
@@ -59,7 +60,7 @@ cv <- function(x, na.rm = TRUE) {
5960
#' prep()
6061
#' rec
6162
#' tidy(rec, 1)
62-
#' juice(rec)
63+
#' bake(rec, new_data = NULL)
6364
step_select_cv <- function(recipe, ..., role = NA, trained = FALSE,
6465
n_kept = NULL,
6566
prop_kept = NULL,
@@ -187,3 +188,9 @@ tidy.step_select_cv <- function(x, ...) {
187188
res
188189
}
189190

191+
192+
#' @rdname required_pkgs.scimo
193+
#' @export
194+
required_pkgs.step_select_cv <- function(x, ...) {
195+
c("scimo")
196+
}

R/select_kruskal.R

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#' prep()
2525
#' rec
2626
#' tidy(rec, 1)
27-
#' juice(rec)
27+
#' bake(rec, new_data = NULL)
2828
step_select_kruskal <- function(recipe, ..., role = NA, trained = FALSE,
2929
outcome = NULL,
3030
n_kept = NULL,
@@ -179,3 +179,10 @@ tidy.step_select_kruskal <- function(x, ...) {
179179
res$id <- x$id
180180
res
181181
}
182+
183+
184+
#' @rdname required_pkgs.scimo
185+
#' @export
186+
required_pkgs.step_select_kruskal <- function(x, ...) {
187+
c("scimo")
188+
}

R/select_wilcoxon.R

+8-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#' prep()
4444
#' rec
4545
#' tidy(rec, 1)
46-
#' juice(rec)
46+
#' bake(rec, new_data = NULL)
4747
step_select_wilcoxon <- function(recipe, ..., role = NA, trained = FALSE,
4848
outcome = NULL,
4949
n_kept = NULL,
@@ -199,3 +199,10 @@ tidy.step_select_wilcoxon <- function(x, ...) {
199199
res$id <- x$id
200200
res
201201
}
202+
203+
204+
#' @rdname required_pkgs.scimo
205+
#' @export
206+
required_pkgs.step_select_wilcoxon <- function(x, ...) {
207+
c("scimo")
208+
}

0 commit comments

Comments
 (0)