Skip to content

Commit

Permalink
Merge pull request #660 from gvelasq/fix-vec-math-base
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr authored Jun 24, 2024
2 parents 28b8219 + 784546d commit 4b06fb1
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 46 deletions.
2 changes: 1 addition & 1 deletion R/num.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ vec_arith.numeric.pillar_num <- vec_arith.pillar_num.default
vec_math.pillar_num <- function(.fn, .x, ...) {
"!!!!DEBUG vec_math(`v(.fn)`)"

out <- vec_math_base(.fn, vec_proxy(.x))
out <- vec_math_base(.fn, vec_proxy(.x), ...)

if (is.numeric(out)) {
out <- vec_restore(out, .x)
Expand Down
84 changes: 40 additions & 44 deletions tests/testthat/_snaps/ggplot2/log-scale.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/testthat/_snaps/num.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,11 @@
Output
<pillar_num{%}*100[3]>
[1] 84.1 90.9 14.1
Code
sum(num(c(1:3, NA)), na.rm = TRUE)
Output
<pillar_num[1]>
[1] 6

# formatting

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-ggplot2.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test_that("ggplot2 snapshot tests", {
log_scale <-
ggplot2::ggplot(data, ggplot2::aes(x, z)) +
ggplot2::geom_point() +
scale_y_num(trans = "log10") +
scale_y_num(transform = "log10") +
ggplot2::theme_minimal(36)

vdiffr::expect_doppelganger("log_scale", log_scale)
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-num.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ test_that("mathematics", {
min(num(1:3, label = "$"))
mean(num(1:3, notation = "eng"))
sin(num(1:3, label = "%", scale = 100))
sum(num(c(1:3, NA)), na.rm = TRUE)
})
})

Expand Down

0 comments on commit 4b06fb1

Please sign in to comment.