Skip to content

Commit 226dc72

Browse files
committed
add is_cran_check()
1 parent 17dcca5 commit 226dc72

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

R/aaa.R

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,13 @@ utils::globalVariables(
1212
)
1313
)
1414

15+
# adapted from ps:::is_cran_check()
16+
is_cran_check <- function() {
17+
if (identical(Sys.getenv("NOT_CRAN"), "true")) {
18+
FALSE
19+
}
20+
else {
21+
Sys.getenv("_R_CHECK_PACKAGE_NAME_", "") != ""
22+
}
23+
}
1524
# nocov end

R/embed.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
#' "Concatenate Embeddings for Categorical Variables with Keras"
123123
#' \url{https://flovv.github.io/Embeddings_with_keras_part2/}
124124
#'
125-
#' @examplesIf embed:::is_tf_available() && rlang::is_installed("modeldata")
125+
#' @examplesIf !embed:::is_cran_check() && rlang::is_installed("modeldata")
126126
#' data(grants, package = "modeldata")
127127
#'
128128
#' set.seed(1)
@@ -150,7 +150,7 @@ step_embed <-
150150
skip = FALSE,
151151
id = rand_id("embed")) {
152152
# warm start for tf to avoid a bug in tensorflow
153-
embed:::is_tf_available()
153+
is_tf_available()
154154

155155
if (is.null(outcome)) {
156156
rlang::abort("Please list a variable in `outcome`")
@@ -254,7 +254,7 @@ prep.step_embed <- function(x, training, info = NULL, ...) {
254254
}
255255

256256
is_tf_2 <- function() {
257-
if (!embed:::is_tf_available()) {
257+
if (!is_tf_available()) {
258258
rlang::abort(
259259
c(
260260
"tensorflow could now be found.",

R/feature_hash.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
#' Approach for Predictive Models_. CRC/Chapman Hall
5151
#' \url{https://bookdown.org/max/FES/encoding-predictors-with-many-categories.html}
5252
#' @seealso [recipes::step_dummy()], [recipes::step_zv()]
53-
#' @examplesIf embed:::is_tf_available() && rlang::is_installed("modeldata")
53+
#' @examplesIf !embed:::is_cran_check() && rlang::is_installed("modeldata")
5454
#' data(grants, package = "modeldata")
5555
#' rec <-
5656
#' recipe(class ~ sponsor_code, data = grants_other) %>%
@@ -94,7 +94,7 @@ step_feature_hash <-
9494
}
9595

9696
# warm start for tf to avoid a bug in tensorflow
97-
embed:::is_tf_available()
97+
is_tf_available()
9898

9999
add_step(
100100
recipe,

man/step_embed.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/step_feature_hash.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)