Skip to content

Commit

Permalink
not explicitely use universal_names, just check for duplictaes and ap…
Browse files Browse the repository at this point in the history
…pend ..<position> in that case
  • Loading branch information
romainfrancois committed Jan 29, 2019
1 parent d10f01b commit 08d6f1b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
9 changes: 5 additions & 4 deletions R/colwise-mutate.R
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,11 @@ manip_apply_syms <- function(funs, syms, tbl) {
} else {
nms <- names(funs)
nms[nms == "<fn>"] <- "fn"
nms <- tibble:::universal_names(nms, quiet = TRUE)
# while(any(dup <- duplicated(nms))) {
# nms[dup] <- paste(nms[dup], which(dup), sep = ".")
# }

# append ..<position> to duplicates
dup <- duplicated(nms)
test <- nms %in% nms[dup]
nms[test] <- paste(nms[test], which(test), sep = "..")
names(funs) <- nms

if (length(syms) == 1 && all(unnamed)) {
Expand Down
4 changes: 2 additions & 2 deletions inst/include/dplyr/hybrid/scalar_result/min_max.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class MinMax : public HybridVectorScalarResult<REALSXP, SlicedTibble, MinMax<RTY
expr(expr_)
{}

~MinMax(){
if(NA_RM && warn) {
~MinMax() {
if (NA_RM && warn) {
if (MINIMUM) {
Rf_warningcall(expr, "no non-missing arguments to min; returning Inf");
} else {
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-colwise-mutate.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ test_that("default names are smallest unique set", {
expect_named(summarise_at(df, vars(x), list(mean = mean, sd = sd)), c("mean", "sd"))
expect_named(summarise_at(df, vars(x:y), list(mean = mean, sd = sd)), c("x_mean", "y_mean", "x_sd", "y_sd"))

skip("discussed in #4125")
expect_named(summarise_at(df, vars(x:y), funs(base::mean, stats::sd)), c("x_base::mean", "y_base::mean", "x_stats::sd", "y_stats::sd"))
})

Expand Down

0 comments on commit 08d6f1b

Please sign in to comment.