Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
将数字转换为字符时如何避免这种情况
> as.character(2146000000) [1] "2.146e+09"
得到这个?
"2146000000"
as.character(2146000000) #[1] "2.146e+09" options(scipen=1) as.character(2146000000) #[1] "2146000000"
另一种选择是sprintf准时使用和更改格式:
sprintf
sprintf("%.0f", 2.146e+09) "2146000000"