S3 Print Methods
Print_Methods.Rd
S3 methods for printing objects of class "announce"
, "binom_contingency"
, "contingency_table"
,
"odds_ratio"
and "summ_anov"
.
Usage
# S3 method for class 'announce'
print(x, ...)
# S3 method for class 'binom_contingency'
print(
x,
width = NULL,
...,
n = NULL,
max_extra_cols = NULL,
max_footer_lines = NULL
)
# S3 method for class 'contingency_table'
print(
x,
width = NULL,
...,
n = NULL,
max_extra_cols = NULL,
max_footer_lines = NULL
)
# S3 method for class 'odds_ratio'
print(
x,
width = NULL,
...,
n = NULL,
max_extra_cols = NULL,
max_footer_lines = NULL,
digits = 7
)
# S3 method for class 'summ_anov'
print(x, ...)
Arguments
- x
an object used to select a method.
- ...
further arguments passed to or from other methods.
- width
only used when
max.levels
is NULL, see above.- n
Number of rows to show. If
NULL
, the default, will print all rows if less than theprint_max
option. Otherwise, will print as many rows as specified by theprint_min
option.- max_extra_cols
Number of extra columns to print abbreviated information for, if the width is too small for the entire tibble. If
NULL
, themax_extra_cols
option is used. The previously definedn_extra
argument is soft-deprecated.Maximum number of footer lines. If
NULL
, themax_footer_lines
option is used.- digits
integer
indicating the maximum number of decimal places for p-values, seeround()
; default 7.
Details
These print methods return their argument x
invisibly, via invisible()
.
Notwithstanding that print.odds_ratio()
rounds p-values to a maximimum number of decimal places as
specified by the digits
argument, p-values will be printed to show no more than three significant figures.
See also
Examples
## print.announce() — print an 'announce' object
announce("x", lead = "Lorem ipsum dolor sit amet")
#> _____________________________
#> Lorem ipsum dolor sit amet: -
#>
#> [1] "x"
(d <- bernoulli_data())
#> ___________________________
#> Simulated Bernoulli Data: -
#>
#> # A tibble: 330 × 2
#> iv dv
#> * <fct> <int>
#> 1 a 1
#> 2 a 0
#> 3 a 0
#> 4 a 0
#> 5 a 0
#> 6 a 0
#> 7 a 1
#> 8 a 1
#> 9 a 1
#> 10 a 0
#> # ℹ 320 more rows
## print.binom_contingency() — print a 'binom_contingency' object
d |> binom_contingency(dv)
#> _____________________________
#> Binomial Contingency Table: -
#>
#> # A tibble: 5 × 3
#> iv pn qn
#> * <fct> <int> <int>
#> 1 a 30 36
#> 2 b 26 40
#> 3 c 26 40
#> 4 d 15 51
#> 5 e 7 59
(d2 <- tibble(
iv = letters[1:4] |> sample(10, replace = TRUE) |> as.factor(),
dv = c("Success", "Fail", "Borderline") |> sample(10, replace = TRUE)
))
#> # A tibble: 10 × 2
#> iv dv
#> <fct> <chr>
#> 1 a Borderline
#> 2 b Success
#> 3 c Success
#> 4 a Fail
#> 5 c Fail
#> 6 c Borderline
#> 7 b Success
#> 8 d Fail
#> 9 c Fail
#> 10 a Borderline
## print.contingency_table() — print a 'contingency_table' object
d2 |> contingency_table(dv)
#> ____________________
#> Contingency Table: -
#>
#> # A tibble: 4 × 4
#> iv Borderline Success Fail
#> * <fct> <int> <int> <int>
#> 1 a 2 0 1
#> 2 b 0 2 0
#> 3 c 1 1 2
#> 4 d 0 0 1
## print.odds_ratio() — print an 'odds_ratio' object
d |> odds_ratio(.dep_var = dv, .ind_var = iv)
#> Waiting for profiling to be done...
#> ____________________________
#> Estimates and Odds Ratios: -
#>
#> # A tibble: 5 × 7
#> parameter estimate se p_val odds_ratio ci[,"2.5%"] [,"97.5%"] sig
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <fct>
#> 1 (Intercept) -0.182 0.247 0.461 1 NA NA NS
#> 2 ivb -0.248 0.353 0.481 0.78 0.389 1.56 NS
#> 3 ivc -0.248 0.353 0.481 0.78 0.389 1.56 NS
#> 4 ivd -1.04 0.384 0.00667 0.353 0.163 0.739 **
#> 5 ive -1.95 0.470 0.0000336 0.142 0.0529 0.341 ***
## print.odds_ratio() — print an 'odds_ratio' object with p values to 12 decimal places
d |> odds_ratio(.dep_var = dv, .ind_var = iv) |> print(digits = 12)
#> Waiting for profiling to be done...
#> ____________________________
#> Estimates and Odds Ratios: -
#>
#> # A tibble: 5 × 7
#> parameter estimate se p_val odds_ratio ci[,"2.5%"] [,"97.5%"] sig
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <fct>
#> 1 (Intercept) -0.182 0.247 0.461 1 NA NA NS
#> 2 ivb -0.248 0.353 0.481 0.78 0.389 1.56 NS
#> 3 ivc -0.248 0.353 0.481 0.78 0.389 1.56 NS
#> 4 ivd -1.04 0.384 0.00667 0.353 0.163 0.739 **
#> 5 ive -1.95 0.470 0.0000336 0.142 0.0529 0.341 ***
## print.summanov() — print a 'summanov' object
d |> summanov(dv, iv)
#> _______________________________________
#> GLM Summary and Analysis of Deviance: -
#>
#> $iv
#> ______________
#> GLM Summary: -
#>
#>
#> Call:
#> glm(formula = inject(!!.dep_var ~ !!sym(x)), family = .family,
#> data = data)
#>
#> Coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -0.1823 0.2472 -0.738 0.46080
#> ivb -0.2485 0.3529 -0.704 0.48146
#> ivc -0.2485 0.3529 -0.704 0.48146
#> ivd -1.0415 0.3839 -2.713 0.00667 **
#> ive -1.9493 0.4700 -4.147 3.36e-05 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> (Dispersion parameter for binomial family taken to be 1)
#>
#> Null deviance: 411.29 on 329 degrees of freedom
#> Residual deviance: 383.34 on 325 degrees of freedom
#> AIC: 393.34
#>
#> Number of Fisher Scoring iterations: 4
#>
#> ____________
#> GLM Anova: -
#>
#> Analysis of Deviance Table
#>
#> Model: binomial, link: logit
#>
#> Response: dv
#>
#> Terms added sequentially (first to last)
#>
#>
#> Df Deviance Resid. Df Resid. Dev Pr(>Chi)
#> NULL 329 411.29
#> iv 4 27.942 325 383.34 1.282e-05 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
rm(d, d2)