File: test-reshape_ci.R

package info (click to toggle)
r-cran-datawizard 1.0.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,300 kB
  • sloc: sh: 13; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 607 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
test_that("reshape_ci with single CI level", {
  df <- data.frame(
    Parameter = c("Term 1"),
    CI = c(0.8),
    CI_low = c(0.2),
    CI_high = c(0.5),
    stringsAsFactors = FALSE
  )

  df_reshape <- reshape_ci(df)

  expect_snapshot(df_reshape)
})


test_that("reshape_ci with multiple CI levels", {
  x <- data.frame(
    Parameter = c("Term 1", "Term 2", "Term 1", "Term 2"),
    CI = c(0.8, 0.8, 0.9, 0.9),
    CI_low = c(0.2, 0.3, 0.1, 0.15),
    CI_high = c(0.5, 0.6, 0.8, 0.85),
    stringsAsFactors = FALSE
  )

  expect_snapshot(reshape_ci(x))
  expect_snapshot(reshape_ci(reshape_ci(x)))
})