Learn R Programming

htmlTable (version 1.0)

txtRound: A convenient rounding function

Description

A convenient rounding function

Usage

txtRound(x, digits, excl.cols, excl.rows)

Arguments

x
The data.frame/matrix to be rounded
digits
The number of digits to round each element to. If you provide a vector each element for corresponding columns.
excl.cols
Rows to exclude from the rounding procedure. This can be either a number or regular expression.
excl.rows
Columns to exclude from the rounding procedure. This can be either a number or regular expression.

Value

  • matrix/data.frame

See Also

Other text formatters: txtMergeLines; txtPval

Examples

Run this code
mx <- matrix(c(1, 1.11, 1.25,
               2.50, 2.55, 2.45,
               3.2313, 3, pi),
             ncol = 3, byrow=TRUE)
txtRound(mx, 1)

Run the code above in your browser using DataLab