Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion r/R/dplyr-arrange.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ find_and_remove_desc <- function(quosure) {
if (identical(expr[[1]], quote(`(`))) {
# remove enclosing parentheses
expr <- expr[[2]]
} else if (identical(expr[[1]], quote(desc))) {
} else if (identical(expr[[1]], quote(desc)) || identical(expr[[1]], quote(dplyr::desc))) {
# ensure desc() has only one argument (when an R expression is a function
# call, length == 2 means it has exactly one argument)
if (length(expr) > 2) {
Expand Down
26 changes: 26 additions & 0 deletions r/tests/testthat/test-dplyr-arrange.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,38 @@ test_that("arrange() on integer, double, and character columns", {
collect(),
tbl
)
compare_dplyr_binding(
.input %>%
arrange(int, dplyr::desc(dbl)) %>%
collect(),
tbl
)
compare_dplyr_binding(
.input %>%
arrange(int, desc(desc(dbl))) %>%
collect(),
tbl
)
compare_dplyr_binding(
.input %>%
arrange(int, dplyr::desc(dplyr::desc(dbl))) %>%
collect(),
tbl
)
compare_dplyr_binding(
.input %>%
arrange(int) %>%
arrange(desc(dbl)) %>%
collect(),
tbl
)
compare_dplyr_binding(
.input %>%
arrange(int) %>%
arrange(dplyr::desc(dbl)) %>%
collect(),
tbl
)
compare_dplyr_binding(
.input %>%
arrange(int + dbl, chr) %>%
Expand Down Expand Up @@ -200,4 +219,11 @@ test_that("arrange() with bad inputs", {
"expects only one argument",
fixed = TRUE
)
expect_error(
tbl %>%
Table$create() %>%
arrange(dplyr::desc(int, chr)),
"expects only one argument",
fixed = TRUE
)
})