pretty_pvalues_compareGroups() takes a createTable object created from compareGroups::createTable(), and applies pretty_pvalues() to all p value columns.

pretty_pvalues_compareGroups(compareGroups_table_obj, digits = 3,
  include_p = FALSE, trailing_zeros = TRUE, output_type = NULL,
  bold = FALSE, italic = FALSE, background = NULL,
  sig_alpha = 0.05)

Arguments

compareGroups_table_obj

createTable object created from compareGroups::createTable() function, with at least one p value column

digits

number of digits to round to; values with zeros past this number of digits are truncated

include_p

TRUE or FALSE: set to TRUE to print "p = " before each p-value

trailing_zeros

TRUE or FALSE: default = TRUE, p-values are formatted with trailing zeros to the defined number of digits (i.e. 0.100 instead of 0.1 if digits= 3)

output_type

output type, either NULL (default), "latex", or "html" (making special charaters latex friendly)

bold

TRUE or FALSE: set to TRUE to bold p-values < the defined significance level

italic

TRUE or FALSE: set to TRUE to italicize p-values < the defined significance level

background

highlight color for p-values < the defined significance level. Default = NULL (no highlighting)

sig_alpha

the defined significance level. Default = 0.05

Value

createTable object with rounding, formating, and highlighting of any p value column.

Details

This function is design specifically for input from compareGroups tables. Use pretty_pvalues directly when working with normal data.frames and other objects.

Examples

data("Bladder_Cancer") cycles_formula <- as.formula(Cycles_cat ~ Age_At_Diagnosis + Gender + Elix_Sum) cycles_compare <- compareGroups::compareGroups(cycles_formula, data = Bladder_Cancer) cycles_table <- compareGroups::createTable(cycles_compare, digits.p = 4, show.p.mul = T) cycles_table_fancy <- pretty_pvalues_compareGroups(cycles_table, background = 'yellow') # Printing createTable object in report compareGroups::export2latex(cycles_table_fancy, size = 'footnotesize', label = 'tab:Variable-of-Interest-Table', caption = 'Comparing Variables to Number of Cycles', header.labels = c('p.overall' = 'Overall P'), landscape = F)
#> \begin{footnotesize} #> \begin{longtable}{lccc}\caption{Comparing Variables to Number of Cycles\label{tab:Variable-of-Interest-Table}}\\ #> \hline #> & 3 & 4+ & \multirow{2}{*}{ Overall P }\\ #> & N=107 & N=59 & \\ #> #> \hline #> \hline #> \endfirsthead #> \multicolumn{4}{l}{\tablename\ \thetable{} \textit{-- continued from previous page}}\\ #> \hline #> & 3 & 4+ & \multirow{2}{*}{ Overall P }\\ #> & N=107 & N=59 & \\ #> #> \hline #> \hline #> \endhead #> \hline #> \multicolumn{4}{l}{\textit{continued on next page}} \\ #> \endfoot #> \multicolumn{4}{l}{} \\ #> \endlastfoot #> Age & 65.7 (8.82) & 64.3 (8.40) & 0.313 \\ #> Gender: & & & 1.000 \\ #> $\qquad$Female & 27 (25.2\%) & 15 (25.4\%) & \\ #> $\qquad$Male & 80 (74.8\%) & 44 (74.6\%) & \\ #> Sum of Elixhauser Comorbidities & 3.83 (2.35) & 3.07 (2.06) & \cellcolor{yellow}{0.032} \\ #> #> \hline #> \end{longtable}\end{footnotesize} #>