Following is part of my data:
Date Elev Temp.C
1 02 January 2010 200 14.7
2 02 January 2010 300 5
3 02 January 2010 500 -2
4 02 January 2010 1000 -9.8
5 02 January 2010 2000 -7.1
I wanted to change the format of the date in to 2010-01-01
or "%Y-%m-%d"
. Class of data
is character
and I tried as follows:
data$Date<-as.Date(data$Date,format="%d%B%Y")
data$Date<-as.Date(data[["Date"]],"%d%B%Y")
data$Date<-strptime(data$Date,"%d%B%Y")
All of the above trials are displaying <NA>
in the Date column. I have another data file with date format of "%m/%d/%Y"
, it worked fine with strptime
, but for the above data set it is not working. Any idea?