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.
解决方案可能非常简单,但我似乎无法轻易弄清楚。我有以下号码:
a = 1000000 #> a #[1] 1e+06
我想将“a”转换为字符串,但是当我尝试使用时toString,它给出了以下内容:
toString
#> toString(a) #[1] "1e+06"
我想得到: 1,000,000 ,用逗号分隔符。这很容易实现吗?谢谢!
format(1e6, big.mark=",", scientific=FALSE)或者 prettyNum(1000000,big.mark=",",scientific=F)应该给你想要的结果
format(1e6, big.mark=",", scientific=FALSE)
prettyNum(1000000,big.mark=",",scientific=F)