Trunc numbers with a specified number of decimals.
See also
Other helpers:
fex(),
obs_footname(),
obs_format(),
obs_freq(),
obs_list.dt(),
obs_out(),
obs_rbind(),
obs_read_csvy(),
obs_roundtime(),
obs_write_csvy(),
rtorf-deprecated,
sr()
Examples
if (FALSE) { # \dontrun{
# Do not run
# in bash:
# printf "%07.4f" 72.05785
# results in 72.0578
# but:
formatC(72.05785, digits = 4, width = 8, format = "f", flag = "0")
# results in
"072.0579"
# the goal is to obtain the same trunc number as using bash, then:
formatC(obs_trunc(72.05785, 4),
digits = 4,
width = 8,
format = "f",
flag = "0")
} # }
