Learn R Programming

tangram (version 0.8.2)

hmisc_p: Cell Generation functions for hmisc default

Description

Each function here is called when a cell is generated. Overriding these in a formula call will allows one to customize exactly how each cell's contents are generated. While this serves as the base template for transforms, it is by no means required if one develops their own bundle of data transforms. One can create ay number of cell level styling choices.

Usage

hmisc_p(p, pformat = "%1.3f", include_p = TRUE)

hmisc_iqr( x, format = NA, na.rm = TRUE, names = FALSE, type = 8, msd = FALSE, quant = c(0.25, 0.5, 0.75), ... )

hmisc_fraction(numerator, denominator, format = 3, ...)

hmisc_fstat(f, df1, df2, p, class = NULL, ...)

hmisc_chi2(chi2, df, p, class = NULL, ...)

hmisc_spearman(S, rho, p, class = NULL, ...)

hmisc_wilcox(V, p, class = NULL, ...)

hmisc_cell

Value

A formatted string or cell as appropriate

Format

An object of class list of length 8.

Arguments

p

numeric; p-value to format

pformat

numeric or character; Significant digits or fmt to pass to sprintf

include_p

logical; include the leading P on the output string

x

numeric; whose sample quantiles are wanted. NA and NaN values are not allowed in numeric vectors unless na.rm is TRUE.

format

numeric or character; Significant digits or fmt to pass to sprintf

na.rm

logical; if true, any NA and NaN's are removed from x before the quantiles are computed.

names

logical; if true, the result has a names attribute. Set to FALSE for speedup with many probs.

type

integer; specify algorithm to use in constructing quantile. See quantile for more information.

msd

logical; compute an msd attribute containing mean and standard deviation

quant

numeric; The quantiles to display. Should be an odd length vector, since the center value is highlighted.

...

additional arguments passed

numerator

numeric; The value of the numerator

denominator

numeric; The value of the denominator

f

The value of the f-statistic

df1

1st dimension degrees of freedom

df2

2nd dimension degrees of freedom

class

character; An optional field for additional S3 classes (e.g. could be used in html rendering for CSS)

chi2

The value of the X^2 statistic

df

degrees of freedom

S

The value of the spearman statistic

rho

The rho value of the test

V

The value of the Wilcoxon statistic

<code>hmisc_p</code>

Given a style in number of digits or a sprintf style specifier it renders the p-value and checks to see if it's all zeros, then switches the output to a less than.

<code>hmisc_iqr</code>

Construct a cell which has the interquartile ranges specified.

<code>hmisc_fraction</code>

Construct a cell which has the fraction specified in an hmisc format

<code>hmisc_fstat</code>

Construct a cell which has the fstat specified in an hmisc format.

<code>hmisc_chi2</code>

Construct a cell which has the chi^2 specified in an hmisc format

<code>hmisc_spearman</code>

Construct a cell which has the spearman specified in an hmisc format

<code>hmisc_wilcox</code>

Construct a cell which has the Wilcoxon specified in an hmisc format

<code>hmisc_cell</code>

List of data transforms for a cell of a table.


hmisc_cell <- list(
  n        = cell_n,
  iqr      = hmisc_iqr,
  fraction = hmisc_fraction,
  fstat    = hmisc_fstat,
  chi2     = hmisc_chi2,
  spearman = hmisc_spearman,
  wilcox   = hmisc_wilcox,
  p        = hmisc_p
)

See Also

hmisc

Examples

Run this code
hmisc_p(1e-6)
hmisc_p(0.234)
hmisc_p(1.234e-6, 5)
hmisc_p(1.234e-6, 6)
require(stats)
hmisc_iqr(rnorm(100), '3')
hmisc_fraction(1, 4, 3)
hmisc_fstat(4.0, 10, 20, 0.004039541)
hmisc_chi2(5.33, 6, 0.2)
hmisc_spearman(20, 0.2, 0.05)
hmisc_wilcox(20, 0.2)

Run the code above in your browser using DataLab