Learn R Programming

surveytable (version 0.9.7)

print.surveytable_table: Print surveytable tables

Description

If a tabulation function is called from the top level, it should print out its table(s) on its own. If that tabulation function is called not from the top level, such as from within a loop or another function, you need to call print() explicitly. For example:

set_survey(namcs2019sv)
for (vr in c("AGER", "SEX")) {
  print( tab_subset(vr, "MAJOR", "Preventive care") )
}

Usage

# S3 method for surveytable_table
print(x, ...)

# S3 method for surveytable_list print(x, ...)

as_object(x, ...)

Value

print.* returns x invisibly.

as_object() returns an object (or a list of objects) of whatever package is being used for printing (such as huxtable).

Arguments

x

an object of class surveytable_table or surveytable_list.

...

passed to helper functions.

Details

The package used to produce the tables can be changed. See set_opts() for details. By default, huxtable is used.

as_object() returns an object (or a list of objects) of whatever package is being used for printing (such as huxtable). This is useful for further customizing the tables before finally printing them.

Examples

Run this code
set_survey(namcs2019sv)
table1 = tab("AGER")
print(table1)
table_many = tab("MDDO", "SPECCAT", "MSA")
print(table_many)

Run the code above in your browser using DataLab