drj|m|emon @end|ng |rom gm@||@com
Thu Nov 4 23:00:28 CET 2021
However, the apparently silent conversion of format is a mystery to
me. The only time I have struck something like this was when exporting
dates from Excel some years ago, and there was a silent conversion to
mm/dd/yyyy format if the dates were in dd/mm/yyyy format. Could you
post some sample data?
On Fri, Nov 5, 2021 at 8:44 AM Val <valkremk using gmail.com> wrote:
> IHi All, l,
> I am reading a csv file and one of the columns is named as "mydate"
> with this form, 2019-09-16.
> I am reading this file as
> the structure of the data looks like as follow
> mydate : chr "09/16/2019" "02/21/2021" "02/22/2021" "10/11/2017" ...
> Please note the format has changed from YYYY-mm-dd to mm/dd/YYYY
> When I tried to change this as a Date using
> as.Date(as.Date(mydate, format="%m/%d/%Y" )
> I am getting this error message
> Error in charToDate(x) :
> characte string is not in a standard unambiguous format
> My question is,
> 1. how can I read the file as it is (i.e., without changing the date format) ?
> 2. why does R change the date format?
> Thank you,
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help