Wal*_*ity 4 r scientific-notation number-formatting
有没有办法防止as.character
使用指数表示法?例如,我有
num <- c(9999999, 10000000)
char <- as.character(num)
char
[1] "9999999" "1e+07"
Run Code Online (Sandbox Code Playgroud)
但相反,我想char
成为"9999999" "10000000"
. 谢谢!
format
是一种功能,可让您选择在转换为字符时如何格式化数字。在这种情况下,类似于
format(c(9999999, 10000000), scientific = FALSE, trim = TRUE)
#> [1] "9999999" "10000000"
Run Code Online (Sandbox Code Playgroud)