[R] Number of digits in paste funciton
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Jun 18 10:53:27 CEST 2008
On Wed, 18 Jun 2008, Tine wrote:
> Does anyone know hot to set number of digits to be printed in function
paste() does not print, so we can only guess at what you mean. The help
'paste' converts its arguments (_via_ 'as.character') to character
strings, and concatenates them (separating them by the string
given by 'sep').
So I guess you are talking about conversion by as.character. And its help
'as.character' represents real and complex numbers to 15
significant digits (technically the compiler's setting of the ISO
C constant 'DBL_DIG', which will be 15 on machines supporting
IEC60559 arithmetic according to the C99 standard). This ensures
that all the digits in the result will be reliable (and not the
result of representation error), but does mean that conversion to
character and back to numeric may change the number. If you want
to convert numbers to character with the maximum possible
precision, use 'format'.
and format() seems to be what you too are looking for (or sprintf or
> Tine Mlač
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
PLEASE do at least read the help before posting, as the posting guides
asks of you.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help