threshold wrote on 12/12/2011 06:23:33 AM:

> Dear R users, I got the following problem. Given that
> 
> > data[3,2]
> [1] "010252"
> 
> Code:
> intro <- data.frame()
> intro[1,1] <- as.character(data[3,2])
> write.csv(intro, file='intro.csv')
> 
> In 'intro.csv' file I am loosing the 0 in frot of 10252, which I need. 
Is
> there a way to keep the full character saved? R 2.13.2 (64 bit).
> 
> Thanks, robert


When I submit similar code (below), the csv file keeps the 0 in front of 
the 10252.
        intro <- data.frame()
        intro[1,1] <- "010252"
        write.csv(intro, file='intro.csv')
Have you tried viewing the csv file with a text editor (e.g., Notepad)? If 
you view the csv file in spreadsheet software (e.g., Excel) it may format 
the values as numbers automatically.

Jean
        [[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