Skip to content

Commit ad33275

Browse files
authored
Merge pull request #425 from tidymodels/update-mapdfc
move away from superseded `map_dfc()`
2 parents c3c8a65 + f7606d1 commit ad33275

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

NAMESPACE

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,8 @@ importFrom(lifecycle,deprecated)
236236
importFrom(pillar,type_sum)
237237
importFrom(purrr,map)
238238
importFrom(purrr,map2)
239-
importFrom(purrr,map2_dfc)
240239
importFrom(purrr,map_chr)
241240
importFrom(purrr,map_dbl)
242-
importFrom(purrr,map_dfc)
243241
importFrom(purrr,map_int)
244242
importFrom(purrr,map_lgl)
245243
importFrom(scales,is.trans)

R/dials-package.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#' @importFrom glue glue glue_collapse
3939
#' @importFrom lifecycle deprecated
4040
#' @importFrom pillar type_sum
41-
#' @importFrom purrr map_lgl map2_dfc map_chr map map2 map_dfc map_dbl map_int
41+
#' @importFrom purrr map map_chr map_dbl map_int map_lgl map2
4242
#' @importFrom scales transform_log2 is.trans transform_log10
4343
#' @importFrom stats runif
4444
#' @importFrom tibble as_tibble is_tibble tibble new_tibble

R/grids.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,10 @@ make_random_grid <- function(
275275
params <- map(param_quos, eval_tidy)
276276

277277
# for now assume equal levels
278-
parameters <- map_dfc(params, value_sample, n = size, original = original)
279278
param_names <- names(param_quos)
279+
parameters <- map(params, value_sample, n = size, original = original)
280280
names(parameters) <- param_names
281+
parameters <- as_tibble(parameters)
281282
if (!(quo_is_null(filter_quo))) {
282283
parameters <- dplyr::filter(parameters, !!filter_quo)
283284
}

R/space_filling.R

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -434,16 +434,15 @@ make_max_entropy_grid <- function(
434434
sf_grid <- as_tibble(sfd$design)
435435

436436
# Get back to parameter units
437-
sf_grid <- map2_dfc(
437+
sf_grid <- map2(
438438
params,
439439
sf_grid,
440440
encode_unit,
441441
direction = "backward",
442442
original = original
443443
)
444-
colnames(sf_grid) <- param_names
445-
446-
sf_grid
444+
names(sf_grid) <- param_names
445+
as_tibble(sf_grid)
447446
}
448447

449448
#' @export
@@ -526,14 +525,13 @@ make_latin_hypercube_grid <- function(
526525
sf_grid <- as_tibble(sfd$design)
527526

528527
# Get back to parameter units
529-
sf_grid <- map2_dfc(
528+
sf_grid <- map2(
530529
params,
531530
sf_grid,
532531
encode_unit,
533532
direction = "backward",
534533
original = original
535534
)
536-
colnames(sf_grid) <- param_names
537-
538-
sf_grid
535+
names(sf_grid) <- param_names
536+
as_tibble(sf_grid)
539537
}

0 commit comments

Comments
 (0)