Skip to content

Commit 28984f2

Browse files
committed
removed argument value and order checking
1 parent 945917b commit 28984f2

File tree

2 files changed

+0
-40
lines changed

2 files changed

+0
-40
lines changed

R/arguments.R

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ prune_arg_list <- function(x, whitelist = NULL, modified = character(0)) {
8383
}
8484

8585
check_others <- function(args, obj) {
86-
# TODO could be local file (maybe ns = NULL?)
87-
88-
fun_args <- formals(getFromNamespace(obj$fit_name["fun"], obj$fit_name["pkg"]))
8986
# Make sure that we are not trying to modify an argument that
9087
# is explicitly protected in the method metadata
9188
common_args <- intersect(obj$protect, names(args))
@@ -96,40 +93,5 @@ check_others <- function(args, obj) {
9693
"and were removed: ",
9794
common_args, call. = FALSE)
9895
}
99-
100-
# If there are not ellipses in function, make sure that the
101-
# args exist in the fit call
102-
if (length(args) > 0 & !any(names(fun_args) == "...")) {
103-
o_names <- names(args)
104-
missing_args <- o_names[!(o_names %in% names(fun_args))]
105-
if (length(missing_args) > 0) {
106-
args[o_names %in% missing_args] <- NULL
107-
warning(
108-
"Some argument(s) do not correspond to this function and were removed: ",
109-
paste0("`", o_names, "`", collapse = ", "),
110-
call. = FALSE
111-
)
112-
}
113-
}
11496
args
11597
}
116-
117-
118-
reorder_args <- function(obj) {
119-
fun_args <-
120-
names(formals(getFromNamespace(obj$fit_name["fun"], obj$fit_name["pkg"])))
121-
obj_args <- obj$fit_args
122-
not_dots_names <- intersect(names(obj_args), fun_args)
123-
not_dots <- obj_args[not_dots_names]
124-
# in order of function definition
125-
common_args <- fun_args[fun_args %in% not_dots_names]
126-
not_dots <- not_dots[common_args]
127-
# add others back in (if any)
128-
if (length(obj_args) > length(not_dots)) {
129-
other_args <- obj_args[!(names(obj_args) %in% common_args)]
130-
not_dots <- c(not_dots, other_args)
131-
}
132-
obj$fit_args <- not_dots
133-
obj
134-
}
135-

R/translate.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ translate.default <- function(x, engine, ...) {
5252

5353
x$method$fit_args <- c(protected, actual_args, x$others, x$alternates)
5454

55-
x$method <- reorder_args(x$method)
56-
5755
# put in correct order
5856
x
5957
}

0 commit comments

Comments
 (0)