Skip to content

Commit b59fdad

Browse files
Add tests from book examples of Discovering statistics (#684)
* Add tests from book examples of Discovering statistics * trigger ci * trigger again * remove skip_on_cran() --------- Co-authored-by: etiennebacher <etienne.bacher@protonmail.com>
1 parent 5ff0d28 commit b59fdad

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Suggests:
4343
brms,
4444
curl,
4545
data.table,
46+
discovr,
4647
dplyr (>= 1.1),
4748
effectsize,
4849
emmeans,

tests/testthat/_snaps/discovr.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# discovr-book-examples, chap 8.8
2+
3+
Code
4+
print(out, table_width = Inf)
5+
Output
6+
Variable | Mean | 95% CI (Mean) | SD | IQR | Skewness | Kurtosis | n | n_Missing
7+
----------------------------------------------------------------------------------------------
8+
adverts | 614.41 | [557.21, 686.82] | 485.66 | 696.21 | 0.85 | 0.24 | 200 | 0
9+
sales | 193.20 | [182.70, 203.48] | 80.70 | 117.50 | 0.04 | -0.68 | 200 | 0
10+
airplay | 27.50 | [25.92, 29.25] | 12.27 | 16.75 | 0.06 | -0.03 | 200 | 0
11+
image | 6.77 | [6.58, 6.98] | 1.40 | 2.00 | -1.29 | 3.74 | 200 | 0
12+

tests/testthat/test-discovr.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
skip_if_not_installed("discovr")
2+
3+
test_that("discovr-book-examples, chap 8.8", {
4+
data(album_sales, package = "discovr")
5+
set.seed(123)
6+
out <- describe_distribution(
7+
album_sales,
8+
range = FALSE,
9+
ci = 0.95,
10+
iterations = 500
11+
)
12+
expect_snapshot(print(out, table_width = Inf))
13+
})

0 commit comments

Comments
 (0)