Created
June 21, 2021 21:14
-
-
Save carbocation/58d11503daf9a76e7e3c8881c87d8ff4 to your computer and use it in GitHub Desktop.
Blends round() and formatC() for my specific needs.
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
roundFormatC <- function(x, digits) { | |
formatCDigits <- digits | |
if(digits <= 0) { | |
formatCDigits <- 0 | |
} | |
formatC(round(x, digits), formatCDigits, format = "f") | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment