[R] reading dates in Excel into R

Dimitri Liakhovitski dimitri.liakhovitski at gmail.com
Fri Jul 30 23:13:22 CEST 2010


I've wasted a lot of time trying to read in dates from Excel. Even
importing .csv files has not guarantees and often produces garbage
instead of dates.
What I found works best is saving the Excel data base as a
tab-delimited file .txt (after having formatted the dates in the
format you need, e.g., mm/dd/yyyy). And then you can read it
(including dates) into R no problems.
Dimitri


On Fri, Jul 30, 2010 at 1:31 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> On Fri, Jul 30, 2010 at 1:17 PM, Hongying Li <colorleaf at hotmail.com> wrote:
>>
>>  I just do not want the dates format change randomly (seems to me) each time I read it from excel2007 file into R.
>> When I export the excel2007 fiel into csv file and use read.csv function then the dates all come out good (as mm/dd/yyyy in csv file).
>> I guess I have to first import into csv file before reading into R. Just avoid reading from Excel2007 files directly.
>> Thanks,
>> Hongying
>>
>
> You could try the various alternatives in the list on this page:
>
>   http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows&s=excel
>
> and see if any of them work in the way you wish.
>
> ______________________________________________
> R-help at 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.
>



-- 
Dimitri Liakhovitski
Ninah Consulting
www.ninah.com



More information about the R-help mailing list