Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

compute.width

Compute maximum column width left and right of a decimal separator


Description

Compute maximum column width left and right of a decimal separator.

Usage

compute.width(v, left = TRUE, single.row = FALSE, bracket = ")")

Arguments

v

A character vector representing a column in a regression table.

left

Should the width left of the separator/bracket be calculated? If FALSE, the width right of the separator/bracket is computed.

single.row

Was the single.row argument used to construct the regression table? I.e., are both the coefficient and uncertainty measure (SE or CI) in the same rows of the matrix?

bracket

The separator symbol to match. These can be closing parentheses (in the case of standard errors when single.row is switched on), closing square brackets (in the case of confidence intervals), or dots (in the case of single.row = FALSE, for decimal alignment at the actual decimal separator).

Details

This function takes a vector of character objects with coefficients, usually a column of a regression table, and computes the maximal width left or right of the decimal separator or bracket at which the cells are aligned vertically. This is useful in the context of the texreg function when the dcolumn or siunitx arguments are used for vertical decimal point alignment.

Value

A number indicating the maximal width left or right of the separator.

Author(s)

Philip Leifeld

See Also


texreg

Conversion of R Regression Output to LaTeX or HTML Tables

v1.37.5
GPL-3
Authors
Philip Leifeld [aut, cre], Claudia Zucca [ctb]
Initial release
2020-06-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.