开发者

How to format zero values in R using prettyNum and zero.print

开发者 https://www.devze.com 2023-01-29 07:31 出处:网络
I would like prettyNum to handle zero values differently; for example, instead of printing \"0\", have it print \"<0.01\". I have been looking at 开发者_开发技巧the zero.print option but have only

I would like prettyNum to handle zero values differently; for example, instead of printing "0", have it print "<0.01". I have been looking at 开发者_开发技巧the zero.print option but have only managed to get it print a single character. If for example you set zero.print="abc", only "a" will get printed (instead of "0").

Can you please let me know how to solve this problem? Or perhaps, prettyNum and zero.print it's not the way to go?

Thank you.


What about using:

print(ifelse(n==0, "<0.05", n))

zero.print seems to accept only 1 character (although the help file talks about "character string"...)

0

精彩评论

暂无评论...
验证码 换一张
取 消