print.svyCatTable: Format and print 'svyCatTable' class objects

View source: R/print.svyCatTable.R

print.svyCatTableR Documentation

Format and print svyCatTable class objects

Description

print method for the svyCatTable class objects created by svyCreateCatTable function.

Usage

## S3 method for class 'svyCatTable'
print(
  x,
  digits = 1,
  pDigits = 3,
  quote = FALSE,
  missing = FALSE,
  explain = TRUE,
  printToggle = TRUE,
  noSpaces = FALSE,
  format = c("fp", "f", "p", "pf")[1],
  showAllLevels = FALSE,
  cramVars = NULL,
  dropEqual = FALSE,
  test = TRUE,
  exact = NULL,
  smd = FALSE,
  CrossTable = FALSE,
  formatOptions = list(scientific = FALSE),
  ...
)

Arguments

x

The result of a call to the svyCreateCatTable function.

digits

Number of digits to print in the table.

pDigits

Number of digits to print for p-values (also used for standardized mean differences).

quote

Whether to show everything in quotes. The default is FALSE. If TRUE, everything including the row and column names are quoted so that you can copy it to Excel easily.

missing

Whether to show missing data information.

explain

Whether to add explanation to the variable names, i.e., (%) is added to the variable names when percentage is shown.

printToggle

Whether to print the output. If FALSE, no output is created, and a matrix is invisibly returned.

noSpaces

Whether to remove spaces added for alignment. Use this option if you prefer to align numbers yourself in other software.

format

The default is "fp" frequency (percentage). You can also choose from "f" frequency only, "p" percentage only, and "pf" percentage (frequency).

showAllLevels

Whether to show all levels. FALSE by default, i.e., for 2-level categorical variables, only the higher level is shown to avoid redundant information.

cramVars

A character vector to specify the two-level categorical variables, for which both levels should be shown in one row.

dropEqual

Whether to drop " = second level name" description indicating which level is shown for two-level categorical variables.

test

Whether to show p-values. TRUE by default. If FALSE, only the numerical summaries are shown.

exact

This option is not available for tables from weighted data.

smd

Whether to show standardized mean differences. FALSE by default. If there are more than one contrasts, the average of all possible standardized mean differences is shown. For individual contrasts, use summary.

CrossTable

Whether to show the cross table objects held internally using gmodels::CrossTable function. This will give an output similar to the PROC FREQ in SAS.

formatOptions

A list of options, which will be passed to format. Can be used to modify the big.mark, decimal.mark, big.interval etc. The default is list(scientific = FALSE). The options digits, nsmall, justify and trim are not available. (Experimental)

...

For compatibility with generic. Ignored.

Value

A matrix object containing what you see is also invisibly returned. This can be assinged a name and exported via write.csv.

Author(s)

Kazuki Yoshida, Alexander Bartel

See Also

svyCreateTableOne, svyCreateCatTable, summary.svyCatTable

Examples


## See the examples for svyCreateTableOne()


tableone documentation built on April 15, 2022, 5:06 p.m.