Skip to content

Commit d21553c

Browse files
committed
fix lints, build_reference_index
1 parent ec1d9c0 commit d21553c

File tree

2 files changed

+40
-31
lines changed

2 files changed

+40
-31
lines changed

R/report.BFBayesFactor.R

+39-31
Original file line numberDiff line numberDiff line change
@@ -12,68 +12,76 @@
1212
#' library(BayesFactor)
1313
#'
1414
#' rez <- BayesFactor::ttestBF(iris$Sepal.Width, iris$Sepal.Length)
15-
#' report_statistics(rez, exact=TRUE) # Print exact BF
16-
#' report(rez, h0="the null hypothesis", h1="the alternative")
15+
#' report_statistics(rez, exact = TRUE) # Print exact BF
16+
#' report(rez, h0 = "the null hypothesis", h1 = "the alternative")
1717
#'
1818
#' rez <- BayesFactor::correlationBF(iris$Sepal.Width, iris$Sepal.Length)
1919
#' report(rez)
2020
#' }
2121
#'
2222
#' @export
23-
report.BFBayesFactor <- function(x, h0="H0", h1="H1", ...) {
24-
if ("BFlinearModel" %in% class(x@numerator[[1]])) {
23+
report.BFBayesFactor <- function(x, h0 = "H0", h1 = "H1", ...) {
24+
if (inherits("BFlinearModel", class(x@numerator[[1]]))) {
2525
return(report(bayestestR::bayesfactor_models(x), ...))
2626
}
2727

2828
if (length(x@numerator) > 1) {
29-
insight::format_alert("Multiple `BFBayesFactor` models detected - reporting for the first numerator model.",
30-
"See help(\"get_parameters\", package = \"insight\").")
29+
insight::format_alert(
30+
"Multiple `BFBayesFactor` models detected - reporting for the first numerator model.",
31+
"See help(\"get_parameters\", package = \"insight\")."
32+
)
3133
x <- x[1]
3234
}
3335

3436
param <- parameters::parameters(x[1], ...)
3537
bf <- param$BF
36-
dir <- ifelse(bf < 1, "h0", "h1")
38+
other_dir <- ifelse(bf < 1, "h0", "h1")
3739

3840

39-
if (dir == "h1") {
40-
text <- paste0("There is ",
41-
effectsize::interpret_bf(bf, ...),
42-
" ",
43-
h1,
44-
" over ",
45-
h0,
46-
" (", report_statistics(x, ...), ").")
41+
if (other_dir == "h1") {
42+
other_text <- paste0(
43+
"There is ",
44+
effectsize::interpret_bf(bf, ...),
45+
" ",
46+
h1,
47+
" over ",
48+
h0,
49+
" (", report_statistics(x, ...), ")."
50+
)
4751
} else {
48-
text <- paste0("There is ",
49-
effectsize::interpret_bf(1/bf, ...),
50-
" ",
51-
h0,
52-
" over ",
53-
h1,
54-
" (", report_statistics(x, ...), ").")
52+
other_text <- paste0(
53+
"There is ",
54+
effectsize::interpret_bf(1 / bf, ...),
55+
" ",
56+
h0,
57+
" over ",
58+
h1,
59+
" (", report_statistics(x, ...), ")."
60+
)
5561
}
56-
text
62+
other_text
5763
}
5864

5965

6066

6167
#' @rdname report.BFBayesFactor
6268
#' @export
6369
report_statistics.BFBayesFactor <- function(x, table = NULL, ...) {
64-
if(is.null(table)) {
70+
if (is.null(table)) {
6571
if (length(x@numerator) > 1) {
66-
insight::format_alert("Multiple `BFBayesFactor` models detected - reporting for the first numerator model.",
67-
"See help(\"get_parameters\", package = \"insight\").")
72+
insight::format_alert(
73+
"Multiple `BFBayesFactor` models detected - reporting for the first numerator model.",
74+
"See help(\"get_parameters\", package = \"insight\")."
75+
)
6876
x <- x[1]
6977
}
7078
table <- parameters::parameters(x, ...)
7179
}
7280

7381
bf <- table$BF
74-
text <- ifelse(bf < 1,
75-
insight::format_bf(1/bf, name="BF01", ...),
76-
insight::format_bf(bf, name="BF10", ...))
77-
text
82+
other_text <- ifelse(bf < 1,
83+
insight::format_bf(1 / bf, name = "BF01", ...),
84+
insight::format_bf(bf, name = "BF10", ...)
85+
)
86+
other_text
7887
}
79-

_pkgdown.yml

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ reference:
9191
- report.stanreg
9292
- report.test_performance
9393
- report.estimate_contrasts
94+
- report.BFBayesFactor
9495

9596
- title: Report Non-Statistical Objects
9697
desc: |

0 commit comments

Comments
 (0)