1414# ' `"html"`, or `"tt"`. `format = "tt"` creates a `tinytable` object, which is
1515# ' either printed as markdown or HTML table, depending on the environment. See
1616# ' [`insight::export_table()`] for details.
17- # ' @param align Only applies to HTML tables. May be one of `"left"`,
18- # ' `"right"` or `"center"`.
19- # ' @param digits,ci_digits,p_digits Number of digits for rounding or
20- # ' significant figures. May also be `"signif"` to return significant
21- # ' figures or `"scientific"` to return scientific notation. Control the
22- # ' number of digits by adding the value as suffix, e.g. `digits = "scientific4"`
23- # ' to have scientific notation with 4 decimal places, or `digits = "signif5"`
24- # ' for 5 significant figures (see also [signif()]).
25- # ' @param subtitle Table title (same as caption) and subtitle, as strings. If `NULL`,
26- # ' no title or subtitle is printed, unless it is stored as attributes (`table_title`,
27- # ' or its alias `table_caption`, and `table_subtitle`). If `x` is a list of
28- # ' data frames, `caption` may be a list of table captions, one for each table.
29- # ' @param font_size For HTML tables, the font size.
30- # ' @param line_padding For HTML tables, the distance (in pixel) between lines.
31- # ' @param column_labels Labels of columns for HTML tables. If `NULL`, automatic
32- # ' column names are generated. See 'Examples'.
33- # ' @inheritParams print.parameters_model
34- # ' @inheritParams insight::format_table
35- # ' @inheritParams insight::export_table
36- # ' @inheritParams compare_parameters
17+ # ' @param ... Arguments passed to the underlying functions, such as `print_md()`
18+ # ' or `print_html()`.
3719# '
3820# ' @return If `format = "markdown"`, the return value will be a character
3921# ' vector in markdown-table format. If `format = "html"`, an object of
4628# ' [vignette](https://easystats.github.io/parameters/articles/model_parameters_formatting.html)
4729# ' for examples.
4830# '
49- # ' @seealso [print.parameters_model()] and [print.compare_parameters()]
31+ # ' @seealso [` print.parameters_model()` ] and [` print.compare_parameters()` ]
5032# '
5133# ' @examplesIf require("gt", quietly = TRUE)
5234# ' model <- lm(mpg ~ wt + cyl, data = mtcars)
9678# ' display(out, select = "{estimate}|{ci}", format = "tt")
9779# ' }
9880# ' @export
99- display.parameters_model <- function (object ,
100- format = " markdown" ,
101- pretty_names = TRUE ,
102- split_components = TRUE ,
103- select = NULL ,
104- caption = NULL ,
105- subtitle = NULL ,
106- footer = NULL ,
107- align = NULL ,
108- digits = 2 ,
109- ci_digits = digits ,
110- p_digits = 3 ,
111- footer_digits = 3 ,
112- ci_brackets = c(" (" , " )" ),
113- show_sigma = FALSE ,
114- show_formula = FALSE ,
115- zap_small = FALSE ,
116- font_size = " 100%" ,
117- line_padding = 4 ,
118- column_labels = NULL ,
119- include_reference = FALSE ,
120- verbose = TRUE ,
121- ... ) {
81+ display.parameters_model <- function (object , format = " markdown" , ... ) {
12282 format <- insight :: validate_argument(format , c(" markdown" , " html" , " md" , " tt" ))
12383
124- fun_args <- list (
125- x = object , pretty_names = pretty_names , split_components = split_components ,
126- select = select , digits = digits , caption = caption , subtitle = subtitle ,
127- footer = footer , ci_digits = ci_digits , p_digits = p_digits ,
128- footer_digits = footer_digits , ci_brackets = ci_brackets ,
129- show_sigma = show_sigma , show_formula = show_formula , zap_small = zap_small ,
130- include_reference = include_reference , verbose = verbose
131- )
132-
13384 if (format %in% c(" html" , " tt" )) {
134- fun_args <- c(
135- fun_args ,
136- list (
137- column_labels = column_labels ,
138- align = align ,
139- font_size = font_size ,
140- line_padding = line_padding ,
141- backend = ifelse(format == " tt" , " tt" , " html" )
142- )
143- )
144- do.call(print_html , c(fun_args , list (... )))
85+ print_html(x = object , backend = ifelse(format == " tt" , " tt" , " html" ), ... )
14586 } else {
146- do.call( print_md , c( fun_args , list ( ... )) )
87+ print_md( x = object , ... )
14788 }
14889}
14990
@@ -153,169 +94,32 @@ display.parameters_simulate <- display.parameters_model
15394# ' @export
15495display.parameters_brms_meta <- display.parameters_model
15596
156-
157- # Compare Parameters ------------------------
158-
159-
16097# ' @export
161- display.compare_parameters <- function (object ,
162- format = " markdown" ,
163- digits = 2 ,
164- ci_digits = digits ,
165- p_digits = 3 ,
166- select = NULL ,
167- column_labels = NULL ,
168- ci_brackets = c(" (" , " )" ),
169- font_size = " 100%" ,
170- line_padding = 4 ,
171- zap_small = FALSE ,
172- ... ) {
173- format <- insight :: validate_argument(format , c(" markdown" , " html" , " md" , " tt" ))
174-
175- fun_args <- list (
176- x = object ,
177- digits = digits ,
178- ci_digits = ci_digits ,
179- p_digits = p_digits ,
180- ci_brackets = ci_brackets ,
181- select = select ,
182- zap_small = zap_small
183- )
184-
185- if (format %in% c(" html" , " tt" )) {
186- fun_args <- c(
187- fun_args ,
188- list (
189- column_labels = column_labels ,
190- font_size = font_size ,
191- line_padding = line_padding ,
192- backend = ifelse(format == " tt" , " tt" , " html" )
193- )
194- )
195- do.call(print_html , c(fun_args , list (... )))
196- } else {
197- do.call(print_md , c(fun_args , list (... )))
198- }
199- }
200-
201-
202- # SEM models ------------------------
98+ display.compare_parameters <- display.parameters_model
20399
204-
205- # ' @rdname display.parameters_model
206100# ' @export
207- display.parameters_sem <- function (object ,
208- format = " markdown" ,
209- digits = 2 ,
210- ci_digits = digits ,
211- p_digits = 3 ,
212- ci_brackets = c(" (" , " )" ),
213- ... ) {
214- format <- insight :: validate_argument(format , c(" markdown" , " html" , " md" , " tt" ))
101+ display.parameters_sem <- display.parameters_model
215102
216- fun_args <- list (
217- x = object ,
218- digits = digits ,
219- ci_digits = ci_digits ,
220- p_digits = p_digits ,
221- ci_brackets = ci_brackets ,
222- backend = ifelse(format == " tt" , " tt" , " html" )
223- )
224-
225- if (format %in% c(" html" , " tt" )) {
226- do.call(print_html , c(fun_args , list (... )))
227- } else {
228- do.call(print_md , c(fun_args , list (... )))
229- }
230- }
231-
232-
233- # PCA /EFA models ------------------------
234-
235-
236- # ' @rdname display.parameters_model
237103# ' @export
238- display.parameters_efa_summary <- function (object , format = " markdown" , digits = 3 , ... ) {
239- format <- insight :: validate_argument(format , c(" markdown" , " html" , " md" , " tt" ))
240- fun_args <- list (x = object , digits = digits , backend = ifelse(format == " tt" , " tt" , " html" ))
241-
242- if (format %in% c(" html" , " tt" )) {
243- do.call(print_html , c(fun_args , list (... )))
244- } else {
245- do.call(print_md , c(fun_args , list (... )))
246- }
247- }
104+ display.parameters_efa_summary <- display.parameters_model
248105
249106# ' @export
250- display.parameters_pca_summary <- display.parameters_efa_summary
107+ display.parameters_pca_summary <- display.parameters_model
251108
252109# ' @export
253- display.parameters_omega_summary <- display.parameters_efa_summary
110+ display.parameters_omega_summary <- display.parameters_model
254111
255-
256- # ' @inheritParams model_parameters.principal
257- # ' @rdname display.parameters_model
258112# ' @export
259- display.parameters_efa <- function (object , format = " markdown" , digits = 2 , sort = FALSE , threshold = NULL , labels = NULL , ... ) {
260- format <- insight :: validate_argument(format , c(" markdown" , " html" , " md" , " tt" ))
261-
262- fun_args <- list (
263- x = object ,
264- digits = digits ,
265- sort = sort ,
266- threshold = threshold ,
267- labels = labels ,
268- backend = ifelse(format == " tt" , " tt" , " html" )
269- )
270-
271- if (format %in% c(" html" , " tt" )) {
272- do.call(print_html , c(fun_args , list (... )))
273- } else {
274- do.call(print_md , c(fun_args , list (... )))
275- }
276- }
113+ display.parameters_efa <- display.parameters_model
277114
278115# ' @export
279- display.parameters_pca <- display.parameters_efa
116+ display.parameters_pca <- display.parameters_model
280117
281118# ' @export
282- display.parameters_omega <- display.parameters_efa
283-
119+ display.parameters_omega <- display.parameters_model
284120
285- # Equivalence tests ------------------------
286-
287-
288- # ' @rdname display.parameters_model
289121# ' @export
290- display.equivalence_test_lm <- function (object , format = " markdown" , digits = 2 , ... ) {
291- print_md(x = object , digits = digits , ... )
292- }
293-
294-
295- # p_function ----------------------------
122+ display.equivalence_test_lm <- display.parameters_model
296123
297124# ' @export
298- display.parameters_p_function <- function (object ,
299- format = " markdown" ,
300- digits = 2 ,
301- ci_width = " auto" ,
302- ci_brackets = TRUE ,
303- pretty_names = TRUE ,
304- ... ) {
305- format <- insight :: validate_argument(format , c(" markdown" , " html" , " md" , " tt" ))
306-
307- fun_args <- list (
308- x = object ,
309- digits = digits ,
310- ci_width = ci_width ,
311- ci_brackets = ci_brackets ,
312- pretty_names = pretty_names ,
313- backend = ifelse(format == " tt" , " tt" , " html" )
314- )
315-
316- if (format %in% c(" html" , " tt" )) {
317- do.call(print_html , c(fun_args , list (... )))
318- } else {
319- do.call(print_md , c(fun_args , list (... )))
320- }
321- }
125+ display.parameters_p_function <- display.parameters_model
0 commit comments