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 8069069 commit d9a310cCopy full SHA for d9a310c
5 files changed
R/acro_init.R
@@ -1,6 +1,6 @@
1
# Globals -----------------------------------------------------------------
2
acro_venv <- "r-acro"
3
-acro_pkg <- "acro==0.4.11"
+acro_pkg <- "acro==0.4.12"
4
ch <- "conda-forge"
5
6
R/output_commands.R
@@ -98,3 +98,30 @@ acro_finalise <- function(path, ext) {
98
}
99
acroEnv$ac$finalise(path, ext)
100
101
+
102
103
+#' Turns suppresssion on during a session
104
+#'
105
+#' @return No return value, called for side effects
106
+#' @export
107
108
+acro_enable_suppression <- function() {
109
+ if (is.null(acroEnv$ac)) {
110
+ stop("ACRO has not been initialised. Please first call acro_init().")
111
+ }
112
+ acroEnv$ac$enable_suppression()
113
+}
114
115
+#' Turns suppresssion off during a session
116
117
118
119
120
+acro_disable_suppression <- function() {
121
122
123
124
+ acroEnv$ac$disable_suppression()
125
126
127
tests/testthat/test-acro_disable_suppression.R
@@ -0,0 +1,14 @@
+test_that("acro_enable_suppression without initialising ACRO object first", {
+ acroEnv$ac <- NULL
+ expect_error(acro_disable_suppression(), "ACRO has not been initialised. Please first call acro_init()")
+})
+test_that("acro_disable_suppression works", {
7
+ testthat::skip_on_cran()
8
+ acro_init()
9
+ foo <- acro_disable_suppression()
10
+ table <- acro_crosstab(index = nursery_data[, c("recommend")], columns = nursery_data[, c("parents")])
11
+ output <- acro_print_outputs()
12
+ status <- "fail"
13
+ expect_true(any(grepl(status, output)))
14
tests/testthat/test-acro_enable_suppression.R
+ expect_error(acro_enable_suppression()(), "ACRO has not been initialised. Please first call acro_init()")
+test_that("acro_enable_suppression works", {
+ acro_enable_suppression()
+ status <- "review"
tests/testthat/test-acro_pivot_table.R
@@ -6,8 +6,10 @@ test_that("acro_pivot_table without initialising ACRO object first", {
test_that("acro_pivot_table works", {
testthat::skip_on_cran()
expected_table <- data.frame(
- "('mean', 'children')" = c(3.272222, 3.242593, 3.241667),
- "('std', 'children')" = c(2.48458394, 2.43848908, 2.42963966),
+# "(mean', 'children')" = c(3.272222, 3.242593, 3.241667),
+# "('std', 'children')" = c(2.48458394, 2.43848908, 2.42963966),
+ "mean children" = c(3.272222, 3.242593, 3.241667),
+ "std children" = c(2.48458394, 2.43848908, 2.42963966),
check.names = FALSE
)
15
@@ -17,6 +19,7 @@ test_that("acro_pivot_table works", {
17
19
18
20
acro_init()
21
table <- acro_pivot_table(data = nursery_data, index = "parents", values = "children", aggfunc = list("mean", "std"))
22
+ print( table)
23
print(expected_table)
24
expect_equal(table[, -1, drop = FALSE], expected_table[, -1, drop = FALSE])
25
})
0 commit comments