When I read in a data file using R, a Date variable is a Factor.
For example, let epc hold the data set. Then if we look at the structure of the first date, we get
str(epc$Date[1]) Factor w/ 1 level "16/12/2006": 1
If you were to convert this to a character, as.character(epc$Date[1]), you'd get exactly the same thing: "16/12/2006"
No matter what I've tried, I can't convert this type of object into a valid date.
if the date is "16/12/2006" (which I'm assuming is Dec. 16th, 2006), then as.Date(epc_full$Date[1]) gives "0016-12-20" -- the full year is lost.
I've tried many different things, e.g., first converting the date into a character, trying different versions of as.Date(), etc., but I keep getting exactly the same result when the input is "16/12/2006"
What's the trick here?