Reputation: 31
When I export to excel using write.csv(XYZ) the date format in the entire column changes to:
01 01 2016
There are GAPS in the Month, Day and Year
Next, when I import the data using "read.csv" and use:
as.Date(XYZ$date), the date format does not change.
If i try to perform any operation on the date column the output is:
Error in filter_impl(.data, dots) : character string is not in a standard unambiguous format
Please help me resolve this. I have also tried to change the Format of the date in Excel, however it doesn't seem to recognize the exported format from R.
Upvotes: 1
Views: 1477
Reputation: 5580
If your problem is that importing to Excel then exporting again to get back into R is changing the format of your dates, try applying something like this after importing back to R
:
as.Date( XYZ$date, format = "%d %m %Y" )
This specifies R's as.Date
function the format of the dates to be converted.
NOTE: preferably avoid this problem by either a) telling Excel not to convert your date values, or b) avoiding Excel entirely :)
Upvotes: 1