We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 30cb270 commit 465a9ffCopy full SHA for 465a9ff
tests/testthat/test-data_summary.R
@@ -139,3 +139,25 @@ test_that("data_summary, print", {
139
out <- data_summary(mtcars, MW = mean(mpg), SD = sd(mpg), by = c("am", "gear"))
140
expect_snapshot(print(out))
141
})
142
+
143
144
+test_that("data_summary, inside functions", {
145
+ foo1 <- function(x, ...) {
146
+ datawizard::data_summary(x, ..., by = "Species")
147
+ }
148
149
+ foo2 <- function(x, by, ...) {
150
+ datawizard::data_summary(x, ..., by = by)
151
152
153
+ foo3 <- function(x, by) {
154
+ datawizard::data_summary(x, MW = mean(Sepal.Width), by = by)
155
156
157
+ data(iris)
158
+ out1 <- foo1(iris, MW = mean(Sepal.Width))
159
+ out2 <- foo2(iris, by = "Species", MW = mean(Sepal.Width))
160
+ out3 <- foo3(iris, "Species")
161
+ expect_equal(out1$MW, out2$MW, tolerance = 1e-4)
162
+ expect_equal(out1$MW, out3$MW, tolerance = 1e-4)
163
+})
0 commit comments