Return a character representation of a number with added zeroes out to a specified number of decimal places.

1 |

`x` |
numeric data (scalar, vector, or matrix). |

`n` |
number of decimal places to show, including zeroes. |

`add2int` |
if |

`round2n` |
if |

A scalar/vector of strings representing numbers. Useful for labelling purposes.

By default, this function does not round or truncate numbers. It simply adds zeroes if
`n`

is greater than the available digits in the decimal part of a number. The user can
choose to round the numbers first by setting argument `round2n = TRUE`

.

Rowan Haigh, Pacific Biological Station, Fisheries and Oceans Canada, Nanaimo BC

`pad0`

, `GT0`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
local(envir=.PBSmodEnv,expr={
oldpar = par(no.readonly=TRUE)
frame()
#do not show decimals on integers
addLabel(0.25,0.75,show0(15.2,4))
addLabel(0.25,0.7,show0(15.1,4))
addLabel(0.25,0.65,show0(15,4))
#show decimals on integers
addLabel(0.25,0.55,show0(15.2,4,TRUE))
addLabel(0.25,0.5,show0(15.1,4,TRUE))
addLabel(0.25,0.45,show0(15,4,TRUE))
par(oldpar)
})
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.