Simple function that can be used as a format function when converting trees to a data.frame
FormatFixedDecimal(x, digits = 3)A string corresponding to x, suitable for printing
data(acme)
print(acme, prob = acme$Get("p", format = function(x) FormatFixedDecimal(x, 4)))
#> levelName prob
#> 1 Acme Inc.
#> 2 ¦--Accounting
#> 3 ¦ ¦--New Software 0.5000
#> 4 ¦ °--New Accounting Standards 0.7500
#> 5 ¦--Research
#> 6 ¦ ¦--New Product Line 0.2500
#> 7 ¦ °--New Labs 0.9000
#> 8 °--IT
#> 9 ¦--Outsource 0.2000
#> 10 ¦--Go agile 0.0500
#> 11 °--Switch to R 1.0000