I am importing a csv, and it stores dates as month-year (Apr-02 for April 2002). In the csv file, there is a day in the value. So Apr-02 would actually have a value in the file as something like 4/10/2002. When I import the file into R, it keeps that Apr-02 format and stores it as a factor. I tried to use
ds$val <- as.Date(ds$val, format = "%b-%y")
to get it as a date, but it results in all NAs. I can do
ds$val <- strptime(paste("1", as.character(ds$val)), format="%d %b-%y")
but I lose the day. Is there a way to get the full date when importing the csv (aside from changing the format in the csv file)?
Thanks!
EDIT:first 5 rows in original format
Attached image of the csv data, in the first is the original format.
If I change the dates to normal format, values are: 4/10/2002, 8/24/1997, 1/6/1999, 10/10/2008, 8/16/1985