File: test-backticks.R

package info (click to toggle)
r-cran-parameters 0.24.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,852 kB
  • sloc: sh: 16; makefile: 2
file content (110 lines) | stat: -rw-r--r-- 3,489 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
skip_on_cran()

data(iris)
iris$`a m` <<- iris$Species
iris$`Sepal Width` <<- iris$Sepal.Width
m1 <- lm(`Sepal Width` ~ Petal.Length + `a m` * log(Sepal.Length), data = iris)
m2 <- lm(Sepal.Width ~ Petal.Length + Species * log(Sepal.Length), data = iris)

test_that("standard_error, backticks", {
  expect_identical(
    standard_error(m1)$Parameter,
    c(
      "(Intercept)", "Petal.Length", "a mversicolor", "a mvirginica",
      "log(Sepal.Length)", "a mversicolor:log(Sepal.Length)", "a mvirginica:log(Sepal.Length)"
    )
  )
  expect_identical(
    standard_error(m2)$Parameter,
    c(
      "(Intercept)", "Petal.Length", "Speciesversicolor", "Speciesvirginica",
      "log(Sepal.Length)", "Speciesversicolor:log(Sepal.Length)", "Speciesvirginica:log(Sepal.Length)"
    )
  )
})


test_that("ci, backticks", {
  expect_identical(
    ci(m1)$Parameter,
    c(
      "(Intercept)", "Petal.Length", "a mversicolor", "a mvirginica",
      "log(Sepal.Length)", "a mversicolor:log(Sepal.Length)", "a mvirginica:log(Sepal.Length)"
    )
  )
  expect_identical(
    ci(m2)$Parameter,
    c(
      "(Intercept)", "Petal.Length", "Speciesversicolor", "Speciesvirginica",
      "log(Sepal.Length)", "Speciesversicolor:log(Sepal.Length)", "Speciesvirginica:log(Sepal.Length)"
    )
  )
  expect_identical(
    ci(m1, method = "wald")$Parameter,
    c(
      "(Intercept)", "Petal.Length", "a mversicolor", "a mvirginica",
      "log(Sepal.Length)", "a mversicolor:log(Sepal.Length)", "a mvirginica:log(Sepal.Length)"
    )
  )
  expect_identical(
    ci(m2, method = "wald")$Parameter,
    c(
      "(Intercept)", "Petal.Length", "Speciesversicolor", "Speciesvirginica",
      "log(Sepal.Length)", "Speciesversicolor:log(Sepal.Length)", "Speciesvirginica:log(Sepal.Length)"
    )
  )
})


test_that("p, backticks", {
  expect_identical(
    p_value(m1)$Parameter,
    c(
      "(Intercept)", "Petal.Length", "a mversicolor", "a mvirginica",
      "log(Sepal.Length)", "a mversicolor:log(Sepal.Length)", "a mvirginica:log(Sepal.Length)"
    )
  )
  expect_identical(
    p_value(m2)$Parameter,
    c(
      "(Intercept)", "Petal.Length", "Speciesversicolor", "Speciesvirginica",
      "log(Sepal.Length)", "Speciesversicolor:log(Sepal.Length)", "Speciesvirginica:log(Sepal.Length)"
    )
  )
})


test_that("model_parameters, backticks", {
  expect_identical(
    model_parameters(m1)$Parameter,
    c(
      "(Intercept)", "Petal.Length", "a mversicolor", "a mvirginica",
      "log(Sepal.Length)", "a mversicolor:log(Sepal.Length)", "a mvirginica:log(Sepal.Length)"
    )
  )
  expect_identical(
    model_parameters(m2)$Parameter,
    c(
      "(Intercept)", "Petal.Length", "Speciesversicolor", "Speciesvirginica",
      "log(Sepal.Length)", "Speciesversicolor:log(Sepal.Length)", "Speciesvirginica:log(Sepal.Length)"
    )
  )
})


test_that("model_parameters-2, backticks", {
  expect_identical(
    model_parameters(select_parameters(m1))$Parameter,
    c(
      "(Intercept)", "a mversicolor", "a mvirginica", "log(Sepal.Length)",
      "a mversicolor:log(Sepal.Length)", "a mvirginica:log(Sepal.Length)"
    )
  )
  expect_identical(
    model_parameters(select_parameters(m2))$Parameter,
    c(
      "(Intercept)", "Speciesversicolor", "Speciesvirginica", "log(Sepal.Length)",
      "Speciesversicolor:log(Sepal.Length)", "Speciesvirginica:log(Sepal.Length)"
    )
  )
})