Human-readable nucleotide scale
human_nt.Rd
Returns a human readable list from a nucleotide position or length.
Value
Returns a list with 4 elements.
- n
A numeric value corresponding to
nt
divided bymult
(see below).- tag
A character, giving the multiplier used in text.
- mult
The muliplier used, in numeric value.
- text
A character, giving the value in a human readable format.
Details
Return a nucleotide value in nt, kb, Mb or Gb, according to the value given. This is particularly useful to display nice scales without too many trailing zeros.
Examples
human_nt(123456)
#> $n
#> [1] 123.456
#>
#> $tag
#> [1] "kb"
#>
#> $mult
#> [1] 1000
#>
#> $text
#> [1] "123.456 kb"
#>
human_nt(123456, signif = 2)
#> $n
#> [1] 120
#>
#> $tag
#> [1] "kb"
#>
#> $mult
#> [1] 1000
#>
#> $text
#> [1] "120 kb"
#>
human_nt(123456890, signif = 2)
#> $n
#> [1] 120
#>
#> $tag
#> [1] "Mb"
#>
#> $mult
#> [1] 1e+06
#>
#> $text
#> [1] "120 Mb"
#>