Created
March 21, 2016 16:16
-
-
Save MatthewRalston/8df5b56401b912128e31 to your computer and use it in GitHub Desktop.
Scientific notation (5x10^5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fancy_scientific <- function(l) { | |
# turn in to character string in scientific notation | |
l <- format(l, scientific = TRUE) | |
# quote the part before the exponent to keep all the digits | |
l <- gsub("^(.*)e", "'\\1'e", l) | |
# turn the 'e+' into plotmath format | |
l <- gsub("e", "%*%10^", l) | |
# return this as an expression | |
parse(text=l) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to Jack Aidley