I don't think you had 'integers' but integer-valued doubles: try
as.integer to get an integer variable. E.g.
x <- 1.1*(10^(1:8))
write.table(data.frame(x, as.integer(x)), "")
"x" "as.integer.x."
"1" 11 11
"2" 110 110
"3" 1100 1100
"4" 11000 11000
"5" 110000 110000
"6" 1100000 1100000
"7" 1.1e+07 11000000
"8" 1.1e+08 110000000
Or see options(scipen=)
options(scipen = 9)
write.table(data.frame(x, as.integer(x)), "")
"x" "as.integer.x."
"1" 11 11
"2" 110 110
"3" 1100 1100
"4" 11000 11000
"5" 110000 110000
"6" 1100000 1100000
"7" 11000000 11000000
"8" 110000000 110000000
On Sun, 22 Feb 2009, Alexy Khrabrov wrote:
I've had a very long file written out by R with write.table, with fields of
time values, converted from POSIXlt as.numeric. Among 2.5 million values,
very few had 6 trailing zeroes, and those were output in scientific notation
as in the subject. Is this the default behavior for long integers, and how
can it be turned off (with all digits for any integer field in write.table)?
They are already for integers: see above.
This is important to interoperate with other languages through such text
dumps, as some do not expect scientific notation for integers, only for
floats.
But you almost certainly had 'floats' in R.
--
Brian D. Ripley, rip...@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
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.