Skip to content
Prev 27704 / 63424 Next

Incorrect paste() output (PR#10801)

On 2/19/2008 9:50 AM, asfe at di.fc.ul.pt wrote:
It looks correct to me.  paste() doesn't use the same formatting rules 
as print() uses.  print() rounded the first number to 7 digits, but 
paste() uses as.character(), which gives

 > as.character(d)
[1] "-0.575999999999999" "-1.552"

If you want output formatted in a particular way, you should use sprintf 
or one of the format* functions.

Duncan Murdoch