@@ -67,6 +67,13 @@ plot.test_likelihoodratio <- function(x, ...) {
6767
6868# ' @export
6969print.test_likelihoodratio <- function (x , digits = 2 , ... ) {
70+ cat(insight :: export_table(format(x , digits = digits , ... ), digits = digits , ... ))
71+ invisible (x )
72+ }
73+
74+
75+ # ' @export
76+ format.test_likelihoodratio <- function (x , digits = 2 , p_digits = 3 , ... ) {
7077 # Footer
7178 if (" LogLik" %in% names(x )) {
7279 best <- which.max(x $ LogLik )
@@ -76,22 +83,39 @@ print.test_likelihoodratio <- function(x, digits = 2, ...) {
7683 }
7784
7885 # value formatting
79- x $ p <- insight :: format_p(x $ p , name = NULL )
86+ x $ p <- insight :: format_p(x $ p , digits = p_digits , name = NULL , ... )
8087
8188 if (is.null(attributes(x )$ estimator )) {
8289 estimator_string <- " "
8390 } else {
8491 estimator_string <- sprintf(" (%s-estimator)" , toupper(attributes(x )$ estimator ))
8592 }
8693
87- cat(insight :: export_table(
88- x ,
89- digits = digits ,
90- caption = c(paste0(" # Likelihood-Ratio-Test (LRT) for Model Comparison" , estimator_string ), " blue" ),
91- footer = footer
92- ))
94+ attr(x , " table_footer" ) <- footer
95+ attr(x , " table_caption" ) <- c(paste0(" # Likelihood-Ratio-Test (LRT) for Model Comparison" , estimator_string ), " blue" )
96+ x
97+ }
9398
94- invisible (x )
99+
100+ # ' @export
101+ print_md.test_likelihoodratio <- function (x , digits = 2 , ... ) {
102+ insight :: export_table(format(x , digits = digits , ... ), format = " markdown" , ... )
103+ }
104+
105+
106+ # ' @export
107+ print_html.test_likelihoodratio <- function (x , digits = 2 , ... ) {
108+ insight :: export_table(format(x , digits = digits , ... ), format = " html" , ... )
109+ }
110+
111+
112+ # ' @export
113+ display.test_likelihoodratio <- function (object , format = " markdown" , digits = 2 , ... ) {
114+ if (format == " markdown" ) {
115+ print_md(x = object , digits = digits , ... )
116+ } else {
117+ print_html(x = object , digits = digits , ... )
118+ }
95119}
96120
97121
0 commit comments