Learn R Programming

data.tree (version 1.1.0)

FormatFixedDecimal: Format a Number as a Decimal

Description

Simple function that can be used as a format function when converting trees to a data.frame

Usage

FormatFixedDecimal(x, digits = 3)

Value

A string corresponding to x, suitable for printing

Arguments

x

a numeric scalar or vector

digits

the number of digits to print after the decimal point

Examples

Run this code
data(acme)
print(acme, prob = acme$Get("p", format = function(x) FormatFixedDecimal(x, 4)))

Run the code above in your browser using DataLab