On 10/14/2011 05:25 AM, Chris Conner wrote:
> Dear Help-Rs,
>  
> I'm working with a file that contains large numbers and I need to export them 
> "as is".  for example take:
>  
>
> x <- 
> c(27104010002005,27104020001805,27104090001810,90050013000140,90050013000120)
> y <- c(1:5)
> df <- data.frame(cbind(x,y))
>  
> When I then try a simple:
> write.csv(df,file="df.csv")
>  
> I get:
>  x y
> 1 2.7104E+13 1
> 2 2.7104E+13 2
> 3 2.71041E+13 3
> 4 9.005E+13 4
> 5 9.005E+13 5
>  
> Then I tried:
> options(scipen=999)
> df$x <- as.character(df$x)

Hi,

You can use format in this case:

df$x <-format(df$x, scientific = FALSE)
write.csv(df,file="df.csv")

regards,
Paul


> write.csv(df,file="df.csv")
>  
> and I still get:
>  x y
> 1 2.7104E+13 1
> 2 2.7104E+13 2
> 3 2.71041E+13 3
> 4 9.005E+13 4
> 5 9.005E+13 5
>  
> How can I have R write the file so it looks like this:
>  x y
> 1 27104010002005
> 2 27104020001805
> 3 27104090001810
> 4 90050013000140
> 5 90050013000120
>       [[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> 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.


-- 
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494

http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770


        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to