Skip to content

Commit 3427448

Browse files
committed
Cleaned up some code
1 parent 334b61b commit 3427448

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

R/arguments.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
#' @importFrom rlang eval_tidy is_quosure na_lgl lgl is_missing ll
22

3-
4-
# `sub_arg_values`` takes an existing expression and substitutes
3+
# `sub_arg_values` takes an existing expression and substitutes
54
# different argument values that are passed to it. `ignore` is
65
# an optional list of arguments that will not have their arguments
76
# substituted.
87

9-
## TODO: test this with something containing ... in definition
10-
118
sub_arg_values <- function (expr, args, ignore = NULL) {
129
arg_names <- names(args)
1310
# Remove ignore

R/fit.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# General TODOs
2-
# - think about case weights in each instance below
3-
# - devise a unit test plan that does not add pkg deps for each model
4-
# - where/how to add data checks (e.g. factors for classification)
2+
# Q: think about case weights in each instance below
3+
# Q: where/how to add data checks (e.g. factors for classification)
54

65

76
#' Fit a Model Specification to a Dataset

R/misc.R

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11

2-
# make S3 with methods for vector, matrix, and recipe
3-
guess_mode <- function(y) {
4-
if (inherits(y, c("character", "factor"))) {
5-
res <- "classification"
6-
} else if (inherits(y, "numeric")) {
7-
res <- "regression"
8-
} else if (inherits(y, "Surv")) {
9-
res <- "risk regression"
10-
} else res <- "unknown"
11-
res
12-
}
13-
142
# Q: make classes for mode too?
153
make_classes <- function(prefix, mode) {
164
cls <- c(paste(prefix, mode, sep = "."), prefix)
@@ -41,7 +29,11 @@ model_printer <- function(x, ...) {
4129
}
4230
if (length(x$others) > 0) {
4331
cat("Engine-Specific Arguments:\n")
44-
others <- lapply(x$others, function(x) paste(deparse(x), sep = "\n", collapse = "\n"))
32+
others <- lapply(x$others,
33+
function(x)
34+
paste(deparse(x),
35+
sep = "\n",
36+
collapse = "\n"))
4537
others <- lapply(others, function(x)
4638
paste0(" ", x, "\n"))
4739
onms <- names(others)

0 commit comments

Comments
 (0)