Skip to content

Commit 70ea358

Browse files
committed
rename to .convert_*() to indicate developer use
1 parent 23a52d2 commit 70ea358

File tree

8 files changed

+83
-83
lines changed

8 files changed

+83
-83
lines changed

NAMESPACE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ S3method(varying_args,recipe)
109109
S3method(varying_args,step)
110110
export("%>%")
111111
export(.cols)
112+
export(.convert_form_to_xy_fit)
113+
export(.convert_form_to_xy_new)
114+
export(.convert_xy_to_form_fit)
115+
export(.convert_xy_to_form_new)
112116
export(.dat)
113117
export(.facts)
114118
export(.lvls)
@@ -124,11 +128,7 @@ export(check_empty_ellipse)
124128
export(check_final_param)
125129
export(contr_one_hot)
126130
export(control_parsnip)
127-
export(convert_form_to_xy_fit)
128-
export(convert_form_to_xy_new)
129131
export(convert_stan_interval)
130-
export(convert_xy_to_form_fit)
131-
export(convert_xy_to_form_new)
132132
export(decision_tree)
133133
export(eval_args)
134134
export(fit)

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# parsnip (development version)
22

3-
* The helper functions `convert_form_to_xy_fit()`, `convert_form_to_xy_new()`, `convert_xy_to_form_fit()`, and `convert_xy_to_form_new()` for converting between formula and matrix interface are now exported for developer use (#508).
3+
* The helper functions `.convert_form_to_xy_fit()`, `.convert_form_to_xy_new()`, `.convert_xy_to_form_fit()`, and `.convert_xy_to_form_new()` for converting between formula and matrix interface are now exported for developer use (#508).
44

55
# parsnip 0.1.6
66

R/convert_data.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
#' of `lm` (and also see the notes at
99
#' https://developer.r-project.org/model-fitting-functions.html).
1010
#'
11-
#' `convert_form_to_xy_fit()` and `convert_xy_to_form_fit()` are for when the
11+
#' `.convert_form_to_xy_fit()` and `.convert_xy_to_form_fit()` are for when the
1212
#' data are created for modeling.
13-
#' `convert_form_to_xy_fit()` saves both the data objects as well as the objects
13+
#' `.convert_form_to_xy_fit()` saves both the data objects as well as the objects
1414
#' needed when new data are predicted (e.g. `terms`, etc.).
1515
#'
16-
#' `convert_form_to_xy_new()` and `convert_xy_to_form_new()` are used when new
16+
#' `.convert_form_to_xy_new()` and `.convert_xy_to_form_new()` are used when new
1717
#' samples are being predicted and only require the predictors to be available.
1818
#'
1919
#' @param data A data frame containing all relevant variables (e.g. outcome(s),
@@ -35,7 +35,7 @@
3535
#'
3636
#' @importFrom stats .checkMFClasses .getXlevels delete.response
3737
#' @importFrom stats model.offset model.weights na.omit na.pass
38-
convert_form_to_xy_fit <- function(formula,
38+
.convert_form_to_xy_fit <- function(formula,
3939
data,
4040
...,
4141
na.action = na.omit,
@@ -161,7 +161,7 @@ convert_form_to_xy_fit <- function(formula,
161161
#' @rdname convert_helpers
162162
#' @keywords internal
163163
#' @export
164-
convert_form_to_xy_new <- function(object,
164+
.convert_form_to_xy_new <- function(object,
165165
new_data,
166166
na.action = na.pass,
167167
composition = "data.frame") {
@@ -237,14 +237,14 @@ convert_form_to_xy_new <- function(object,
237237
#' @param weights A numeric vector containing the weights.
238238
#' @param y_name A string specifying the name of the outcome.
239239
#' @inheritParams fit.model_spec
240-
#' @inheritParams convert_form_to_xy_fit
240+
#' @inheritParams .convert_form_to_xy_fit
241241
#'
242242
#' @rdname convert_helpers
243243
#' @keywords internal
244244
#' @export
245245
#'
246246
#' @importFrom dplyr bind_cols
247-
convert_xy_to_form_fit <- function(x,
247+
.convert_xy_to_form_fit <- function(x,
248248
y,
249249
weights = NULL,
250250
y_name = "..y",
@@ -297,7 +297,7 @@ convert_xy_to_form_fit <- function(x,
297297
#' @rdname convert_helpers
298298
#' @keywords internal
299299
#' @export
300-
convert_xy_to_form_new <- function(object, new_data) {
300+
.convert_xy_to_form_new <- function(object, new_data) {
301301
new_data <- new_data[, object$x_var, drop = FALSE]
302302
if (!is.data.frame(new_data))
303303
new_data <- as.data.frame(new_data)

R/descriptors.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ get_descr_form <- function(formula, data) {
115115
get_descr_df <- function(formula, data) {
116116

117117
tmp_dat <-
118-
convert_form_to_xy_fit(formula,
118+
.convert_form_to_xy_fit(formula,
119119
data,
120120
indicators = "none",
121121
remove_intercept = TRUE)
@@ -132,7 +132,7 @@ get_descr_df <- function(formula, data) {
132132

133133
.cols <- function() {
134134
ncol(
135-
convert_form_to_xy_fit(
135+
.convert_form_to_xy_fit(
136136
formula,
137137
data,
138138
indicators = "traditional",
@@ -296,7 +296,7 @@ get_descr_xy <- function(x, y) {
296296
}
297297

298298
.dat <- function() {
299-
convert_xy_to_form_fit(x, y, remove_intercept = TRUE)$data
299+
.convert_xy_to_form_fit(x, y, remove_intercept = TRUE)$data
300300
}
301301

302302
.x <- function() {

R/fit_helpers.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ form_xy <- function(object, control, env,
117117
indicators <- encoding_info %>% dplyr::pull(predictor_indicators)
118118
remove_intercept <- encoding_info %>% dplyr::pull(remove_intercept)
119119

120-
data_obj <- convert_form_to_xy_fit(
120+
data_obj <- .convert_form_to_xy_fit(
121121
formula = env$formula,
122122
data = env$data,
123123
...,
@@ -163,7 +163,7 @@ xy_form <- function(object, env, control, ...) {
163163
remove_intercept <- encoding_info %>% dplyr::pull(remove_intercept)
164164

165165
data_obj <-
166-
convert_xy_to_form_fit(
166+
.convert_xy_to_form_fit(
167167
x = env$x,
168168
y = env$y,
169169
weights = NULL,

R/predict.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,9 @@ prepare_data <- function(object, new_data) {
358358
if (any(pp_names == "terms") | any(pp_names == "x_var")) {
359359
# Translation code
360360
if (fit_interface == "formula") {
361-
new_data <- convert_xy_to_form_new(object$preproc, new_data)
361+
new_data <- .convert_xy_to_form_new(object$preproc, new_data)
362362
} else {
363-
new_data <- convert_form_to_xy_new(object$preproc, new_data)$x
363+
new_data <- .convert_form_to_xy_new(object$preproc, new_data)$x
364364
}
365365
}
366366

man/convert_helpers.Rd

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)