es_round: round ouptut of EdSurvey functions before printing

View source: R/es_round.R

es_roundR Documentation

round ouptut of EdSurvey functions before printing

Description

Applies rounding rules

Usage

es_round(
  object,
  round_n = getOption("EdSurvey_round_n_function"),
  round_pop_n = getOption("EdSurvey_round_pop_n_function"),
  round_est = getOption("EdSurvey_round_est_function"),
  round_est_se = getOption("EdSurvey_round_est_se_function"),
  round_pct = getOption("EdSurvey_round_pct_function"),
  round_pct_se = getOption("EdSurvey_round_pct_se_function"),
  round_specific_element = NULL,
  ...
)

Arguments

object

the object (usually the result of an analysis function) to be rounded

round_n

function used to round sample n-sizes

round_pop_n

function used to round weighted n-sizes, these are also called population size estimates

round_est

function used to round estimates; examples include means and percentiles of scores, as well as regression coefficients

round_est_se

function used to round standard errors of estimates

round_pct

function used to round percentages

round_pct_se

function used to round the standard errors of percentages

round_specific_element

a list of rounding functions, the function is applied to elements with that name. See Examples

...

additional arguments passed to methods

rounds every statistic that is a function of data, including the header and tables

Value

the object is returned, with relevant elements rounded

Author(s)

Paul Bailey

Examples

## Not run: 
# read in the example data (generated, not real student data)
sdf <- readNAEP(path=system.file("extdata/data", "M36NT2PM.dat", package = "NAEPprimer"))

# by default uses jackknife variance method using replicate weights
es1 <- edsurveyTable(formula=composite ~ dsex + b017451, data=sdf)
# turn on rounding by default
options(EdSurvey_round_output= TRUE)
es1
# turn off rounding by default
options(EdSurvey_round_output= FALSE)

# request rounding for this outpt
print(es1, use_es_round=TRUE)
# round, then print

# round the PCT column to one digit
es_round(es1, round_specific_element=list(PCT=roundn(1)))


## End(Not run)

EdSurvey documentation built on June 27, 2024, 5:10 p.m.