Learn R Programming

surveytable (version 0.9.7)

set_opts: Set certain options

Description

set_opts() sets certain options. To view these options, use show_opts(). For more advanced control and detailed customization, experienced users can also employ options() and show_options() (refer to surveytable-options for further information).

Usage

set_opts(
  mode = NULL,
  count = NULL,
  lpe = NULL,
  drop_na = NULL,
  max_levels = NULL,
  csv = NULL,
  output = NULL
)

show_opts()

Value

(Nothing.)

Arguments

mode

"general" or "NCHS". See below for details.

count

round counts to the nearest: integer ("int") or one thousand ("1k")

lpe

identify low-precision estimates?

drop_na

drop missing values (NA)? Categorical variables only.

max_levels

a categorical variable can have at most this many levels. Used to avoid printing huge tables.

csv

name of a CSV file or "" to turn off CSV output.

output

package to use for printing. One of "huxtable", "gt", or "kableExtra". For the last two, be sure that this package is installed. "auto" (default) = automatically select huxtable for screen, gt for HTML, or kableExtra for PDF (LaTeX).

Details

If you are not setting a particular option, leave it as NULL.

mode can be either "general" or "NCHS" and has the following meaning:

  • "general":

    • Round counts to the nearest integer -- same as count = "int".

    • Do not look for low-precision estimates -- same as lpe = FALSE.

    • Percentage CI's: use standard Korn-Graubard CI's.

  • "nchs":

    • Round counts to the nearest 1,000 -- same as count = "1k".

    • Identify low-precision estimates -- same as lpe = TRUE.

    • Percentage CI's: adjust Korn-Graubard CI's for the number of degrees of freedom, matching the SUDAAN calculation. NHIS users, be sure to also type options(surveytable.adjust_svyciprop.df_method = "NHIS").

See Also

Other options: set_survey(), show_options(), surveytable-options

Examples

Run this code
# Send output to a CSV file:
file_name = tempfile(fileext = ".csv")
suppressMessages( set_opts(csv = file_name) )
set_survey(namcs2019sv)
tab("AGER")
set_opts(csv = "") # Turn off CSV output

show_opts()

Run the code above in your browser using DataLab