scinot: scinot - Convert a number to a scientific notation expression

scinotR Documentation

scinot - Convert a number to a scientific notation expression

Description

This function will convert any numeric vector

Usage

scinot(v, digits = 3)

Arguments

v

The input numeric object. It can be a single value or a vector

digits

An integer indicating how many significant digits to show. Default is 3.

Value

An object of class _expression_.

Examples

# Usage on single value
scinot(0.00000543)
# Demonstration on a vector
numbers<-c(3.456e-12,0.00901,5670000,-3.16e18,0.000004522,rnorm(5,sd=0.0000001))
plot(0,xlim=c(0,10),ylim=c(0,10),type="n")
text(c(2,6),c(10,10),labels=c("Before","After"),font=2)
for(i in 10:1){
    text(c(2,6),c(i-1,i-1),labels=c(numbers[i],scinot(numbers)[i]))
}

federicogiorgi/corto documentation built on April 24, 2023, 1:23 a.m.