Skip to content

Commit edcddce

Browse files
committed
removed or consolidated functions
1 parent fbd544a commit edcddce

File tree

10 files changed

+6
-82
lines changed

10 files changed

+6
-82
lines changed

R/aaa.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ convert_stan_interval <- function(x, level = 0.95, lower = TRUE) {
2121
# ------------------------------------------------------------------------------
2222

2323
#' @importFrom utils globalVariables
24-
utils::globalVariables(c("value", "engine", "lab", "original", "engine2"))
24+
utils::globalVariables(
25+
c('.', '.label', '.pred', '.row', 'data', 'engine', 'engine2', 'group',
26+
'lab', 'original', 'predicted_label', 'prediction', 'value')
27+
)

R/aaa_spark_helpers.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,3 @@ format_spark_num <- function(results, object) {
2020
results <- dplyr::rename(results, pred = prediction)
2121
results
2222
}
23-
24-
#' @importFrom utils globalVariables
25-
utils::globalVariables(c(".", "predicted_label", "prediction"))

R/arguments.R

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,6 @@ null_value <- function(x) {
77
res
88
}
99

10-
deharmonize <- function(args, key, engine) {
11-
nms <- names(args)
12-
orig_names <- key[nms, engine]
13-
names(args) <- orig_names
14-
args[!is.na(orig_names)]
15-
}
16-
17-
parse_engine_options <- function(x) {
18-
res <- ll()
19-
if (length(x) >= 2) { # in case of NULL
20-
21-
arg_names <- names(x[[2]])
22-
arg_names <- arg_names[arg_names != ""]
23-
24-
if (length(arg_names) > 0) {
25-
# in case of list()
26-
res <- ll()
27-
for (i in arg_names) {
28-
res[[i]] <- x[[2]][[i]]
29-
} # over arg_names
30-
} # length == 0
31-
}
32-
res
33-
}
34-
35-
prune_arg_list <- function(x, whitelist = NULL, modified = character(0)) {
36-
nms <- names(x)
37-
if (length(whitelist) > 0)
38-
nms <- nms[!(nms %in% whitelist)]
39-
for (i in nms) {
40-
if (
41-
is.null(x[[i]]) |
42-
is_null(x[[i]]) |
43-
!(i %in% modified) |
44-
is_missing(x[[i]])
45-
)
46-
x[[i]] <- NULL
47-
}
48-
if(any(names(x) == "..."))
49-
x["..."] <- NULL
50-
x
51-
}
52-
5310
check_eng_args <- function(args, obj, core_args) {
5411
# Make sure that we are not trying to modify an argument that
5512
# is explicitly protected in the method metadata or arg_key

R/boost_tree.R

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,3 @@ C50_by_tree <- function(tree, object, new_data, type, ...) {
503503
pred[, c(".row", "trees", nms)]
504504
}
505505

506-
507-
# ------------------------------------------------------------------------------
508-
509-
#' @importFrom utils globalVariables
510-
utils::globalVariables(c(".row"))

R/fit_helpers.R

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,3 @@ xy_form <- function(object, env, control, ...) {
181181
res
182182
}
183183

184-
# ------------------------------------------------------------------------------
185-
##
186-
187-
188-
#' @importFrom utils globalVariables
189-
utils::globalVariables("data")

R/logistic_reg.R

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,3 @@ predict_raw._lognet <- function (object, new_data, opts = list(), ...) {
355355
predict_raw.model_fit(object, new_data = new_data, opts = opts, ...)
356356
}
357357

358-
359-
# ------------------------------------------------------------------------------
360-
361-
#' @importFrom utils globalVariables
362-
utils::globalVariables(c("group", ".pred"))

R/misc.R

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,6 @@ make_call <- function(fun, ns, args, ...) {
132132
out
133133
}
134134

135-
resolve_args <- function(args, ...) {
136-
for (i in seq(along = args)) {
137-
if (!is_missing_arg(args[[i]]))
138-
args[[i]] <- eval_tidy(args[[i]], ...)
139-
}
140-
args
141-
}
142-
143135
levels_from_formula <- function(f, dat) {
144136
if (inherits(dat, "tbl_spark"))
145137
res <- NULL

R/multinom_reg.R

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,3 @@ check_glmnet_lambda <- function(dat, object) {
322322
dat
323323
}
324324

325-
# ------------------------------------------------------------------------------
326-
327-
#' @importFrom utils globalVariables
328-
utils::globalVariables(c("group", ".pred"))

R/surv_reg.R

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,3 @@ flexsurv_quant <- function(results, object) {
208208
results <- map(results, setNames, c(".quantile", ".pred", ".pred_lower", ".pred_upper"))
209209
}
210210

211-
# ------------------------------------------------------------------------------
212-
213-
#' @importFrom utils globalVariables
214-
utils::globalVariables(".label")
215-

R/translate.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ translate.default <- function(x, engine = x$engine, ...) {
6868
arg_key <- get_args(mod_name, engine)
6969

7070
# deharmonize primary arguments
71-
actual_args <- unionize(x$args, arg_key)
71+
actual_args <- deharmonize(x$args, arg_key)
7272

7373
# check secondary arguments to see if they are in the final
7474
# expression unless there are dots, warn if protected args are
@@ -155,7 +155,7 @@ get_args <- function(model, engine) {
155155
}
156156

157157
# to replace harmonize
158-
unionize <- function(args, key) {
158+
deharmonize <- function(args, key) {
159159
if (length(args) == 0)
160160
return(args)
161161
parsn <- tibble(parsnip = names(args), order = seq_along(args))

0 commit comments

Comments
 (0)