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

coeftostring

Convert a number into a string with rounded decimal places


Description

Reformat a coefficient as a string with a certain number of decimal places.

Usage

coeftostring(x, lead.zero = FALSE, digits = 2)

Arguments

x

A numeric object to reformat.

lead.zero

Should a leading zero be printed if the coefficient is non-negative and smaller than one (e.g., "0.23" as opposed to ".23")?

digits

Number of decimal places to round to.

Details

This function takes a numeric object, usually a coefficient from a statistical model, and converts it into a character object. The user can choose to how many decimal places the number is rounded (usually two in most published regression models) and whether there should be a leading zero if the coefficient is between 0 and 1.

Value

A reformatted coefficient string as a character object.

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.