Skip to content

Commit eec8c06

Browse files
avoid mutate() since it has not exactly dplyr::mutate() schemantics (nse, !!, etc.) and it's not intended to be used in source code anyways
1 parent bac9a1d commit eec8c06

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

R/compat-dplyr.R

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,3 @@ map_dfr <- function(.x, .f, ...) {
5757
res <- map(.x, .f, ...)
5858
vec_rbind(!!!res)
5959
}
60-
61-
mutate <- function(.data, ...) {
62-
collected <- list(...)
63-
for (idx in seq_along(collected)) {
64-
.data[names(collected)[idx]] <- unname(collected[[idx]])
65-
}
66-
67-
.data
68-
}

tests/testthat/test-cache-low-level-api.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
test_that("caching utils make right blocks with semi-colon", {
22
blocks_simple_uncached <- compute_parse_data_nested(c("1 + 1", "2; 1+1")) %>%
3-
mutate(is_cached = FALSE) %>%
3+
base::transform(is_cached = FALSE) %>%
44
cache_find_block()
55
expect_equal(blocks_simple_uncached, c(1, 1, 1, 1))
66

77
blocks_simple_cached <- compute_parse_data_nested(c("1 + 1", "2; 1+1")) %>%
8-
mutate(is_cached = TRUE) %>%
8+
base::transform(is_cached = TRUE) %>%
99
cache_find_block()
1010
expect_equal(blocks_simple_cached, c(1, 1, 1, 1))
1111

1212
blocks_edge <- compute_parse_data_nested(c("1 + 1", "2; 1+1")) %>%
13-
mutate(is_cached = c(TRUE, TRUE, FALSE, FALSE)) %>%
13+
base::transform(is_cached = c(TRUE, TRUE, FALSE, FALSE)) %>%
1414
cache_find_block()
1515
expect_equal(blocks_edge, c(1, 2, 2, 2))
1616
})
@@ -30,7 +30,7 @@ test_that("caching utils make right blocks with comments", {
3030

3131

3232
blocks_simple_uncached <- compute_parse_data_nested(text) %>%
33-
mutate(is_cached = c(
33+
base::transform(is_cached = c(
3434
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE,
3535
TRUE, FALSE, FALSE, FALSE
3636
)) %>%
@@ -48,7 +48,7 @@ test_that("caching utils make right blocks with comments", {
4848
tau1 = 1 # here?
4949
"
5050
blocks_simple_cached <- compute_parse_data_nested(text) %>%
51-
mutate(is_cached = c(
51+
base::transform(is_cached = c(
5252
FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE
5353
)) %>%
5454
cache_find_block()
@@ -101,17 +101,17 @@ test_that("blank lines are correctly identified", {
101101

102102
test_that("caching utils make right blocks with comments", {
103103
blocks_simple_uncached <- compute_parse_data_nested(c("1 + 1", "2 # comment")) %>%
104-
mutate(is_cached = FALSE) %>%
104+
base::transform(is_cached = FALSE) %>%
105105
cache_find_block()
106106
expect_equal(blocks_simple_uncached, c(1, 1, 1))
107107

108108
blocks_simple_cached <- compute_parse_data_nested(c("1 + 1", "2 # comment2")) %>%
109-
mutate(is_cached = TRUE) %>%
109+
base::transform(is_cached = TRUE) %>%
110110
cache_find_block()
111111
expect_equal(blocks_simple_cached, c(1, 1, 1))
112112

113113
blocks_edge <- compute_parse_data_nested(c("1 + 1", "2 # 1+1")) %>%
114-
mutate(is_cached = c(TRUE, TRUE, FALSE)) %>%
114+
base::transform(is_cached = c(TRUE, TRUE, FALSE)) %>%
115115
cache_find_block()
116116
expect_equal(blocks_edge, c(1, 2, 2))
117117
})

0 commit comments

Comments
 (0)