sci_label.RdConvert integers to scientific notation labels
sci_label(in_num, sig_figs = 2, type = "ggplot2")a numeric vector
a number indicating how many significant figures should be displayed.
Either "ggplot2", "DT", or "text", which will set how the values are returned. "ggplot2" gives formatting good for ggplot2 labels, e.g. 4.7%*%10^-4. "DT" returns formatting good for use with the DT package, e.g. 4.7\u271510<sup>-4</sup>. "text" returns basic text formatting, e.g. 4.7E-4
a character vector with numeric values reformatted for display
my_numbers <- c(100,15.359,32687,.000468)
sci_label(my_numbers)
#> [1] "1.0%*%10^2" "1.5%*%10^1" "3.3%*%10^4" "4.7%*%10^-4"
sci_label(my_numbers, sig_figs = 3)
#> [1] "1.00%*%10^2" "1.54%*%10^1" "3.27%*%10^4" "4.68%*%10^-4"