Hi David, Its strange ... when I run this separately it works ... but I when I do in my function it changes the format. I just opened it using Notepad.
-----Original Message----- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: 01 November 2010 19:15 To: Santosh Srinivas Cc: 'Rhelp' Subject: Re: [R] write.csv changes the format of the date On Nov 1, 2010, at 9:14 AM, Santosh Srinivas wrote: > Dear Group, > > Why does write.csv modify the date format when it write to a file. > > I have the following variable Param_Dat: > > dput(Param_Dat) > structure(list(Last_Successful_Run = structure(1L, .Label = > "30/10/2010", > class = "factor")), .Names = "Last_Successful_Run", class = > "data.frame", > row.names = c(NA, > -1L)) > > > When I do: > write.csv(Param_Dat,"Param.csv",quote=F,row.names=F) > > The format of the info in the file is: > Last_Successful_Run > 31OCT2010 Unable to reproduce. When I execute that code I get this file: Last_Successful_Run 30/10/2010 I'm guessing you are viewing that file with something other than a plain text editor. > > I want to retain the dd/mm/YYYY format ... > > Please advise. -- David Winsemius, MD West Hartford, CT > sessionInfo() R version 2.11.1 Patched (2010-06-14 r52281) x86_64-apple-darwin9.8.0 locale: [1] en_US/en_US/en_US/C/en_US/en_US attached base packages: [1] splines stats graphics grDevices utils datasets methods [8] base other attached packages: [1] Hmisc_3.8-1 survival_2.35-8 dismo_0.5-6 rJava_0.8-7 [5] raster_1.5-16 sp_0.9-72 sos_1.2-9 brew_0.1-1 [9] lattice_0.18-8 loaded via a namespace (and not attached): [1] cluster_1.12.3 grid_2.11.1 tools_2.11.1 ______________________________________________ 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.