Description Usage Arguments Value Examples
This function is a helper function to print integers or double precision values for your own convenience. If the number doesn't fit, it will be stretched which might cause an issue (for aligning your prints). Remember that negative value signs take 1 one space in digits.
1 | print_hyb(number, digits = 4, decimals = -1)
|
number |
Type: numeric. The integer / double precision value you want formatted. |
digits |
Type: integer. The number of digits you want to print (pre-dot). |
decimals |
Type: integer. The number of decimals you want to print (post-dot). |
The formatted double precision value.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | print_hyb(12, 7) # "0000012"
print_hyb(12, 6) # "000012"
print_hyb(12, 5) # "00012"
print_hyb(12, 4) # "0012"
print_hyb(12, 3) # "012"
print_hyb(12, 1) # "12"
print_hyb(12, 2) # "12"
print_hyb(123456, 7) # "0123456"
print_hyb(123456789, 7) # "123456789"
print_hyb(-12, 4) # "-012"
print_hyb(-12, 3) # "-12"
print_hyb(-12, 2) # "-12"
print_hyb(-12, 1) # "-12"
print_hyb(-1234, 6) # "-01234"
print_hyb(-1234, 5) # "-1234"
print_hyb(-1234, 4) # "-1234"
print_hyb(123.456, 5, 5) # "00123.45600"
print_hyb(123.456, 5, 4) # "00123.4560"
print_hyb(123.456, 5, 3) # "00123.456"
print_hyb(123.456, 5, 2) # "00123.46"
print_hyb(123.456, 5, 1) # "00123.5"
print_hyb(123.456, 5, 0) # "00123"
print_hyb(123.456, 4, 0) # "0123"
print_hyb(123.456, 3, 0) # "123"
print_hyb(123.456, 2, 0) # "123"
print_hyb(123.456, 1, 0) # "123"
print_hyb(-123.456, 5, 5) # "-0123.45600"
print_hyb(-123.456, 5, 4) # "-0123.4560"
print_hyb(-123.456, 5, 3) # "-0123.456"
print_hyb(-123.456, 5, 2) # "-0123.46"
print_hyb(-123.456, 5, 1) # "-0123.5"
print_hyb(-123.456, 5, 0) # "-0123"
print_hyb(-123.456, 4, 0) # "-123"
print_hyb(-123.456, 3, 0) # "-123"
print_hyb(-123.456, 2, 0) # "-123"
print_hyb(-123.456, 1, 0) # "-123"
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.