[R] Date format issue.
David Winsemius
dwinsemius at comcast.net
Tue Jun 28 15:25:50 CEST 2011
On Jun 28, 2011, at 8:04 AM, Ashim Kapoor wrote:
> Dear R helpers,
>
> I have 2 questions : -
>
> 1. My excel sheet has a column with dates like 01/03/1980 which is
> formatted
> as 03/80 when I read this into R it reads as Mar-80.
You should be able to change that from the format menu in Excel. If
you use a "custom" format of yyyy-mm-dd and then save as csv you get
dates in "%Y-%m-%d" acceptable format for importing, namely your date
which on the data entry line appears as 3/1/80 appears in the cell as
1980-03-01, and likewise in the text output the same way, and could be
input using a colClasses argument of "Date".
> How can I read it in
> the source format ?
>
> 2.
>
>> v<-c("Mar-80")
>> as.Date(v,format="%b-%y")
> [1] NA
>>
>
> Could someone please tell me where I am wrong in this date format
> conversion
> ?
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list