Skip to contents

Returns a human readable list from a nucleotide position or length.

Usage

human_nt(nt, signif = FALSE)

Arguments

nt

A nucleotide position.

signif

Either a numeric or logical. If FALSE, nt is not rounded. If this argument is numeric, it returns that amount of significant digits.

Value

Returns a list with 4 elements.

n

A numeric value corresponding to nt divided by mult (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.

Author

Lionel Guy

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"
#>