I have a dataframe column that has dates in this format : %Y-%M when I check the type, it is character. I still get the fortmat "%Y-%M-%D even when I try to convert it into a date type using the following code :
df$dates <- as.Date(df$Month_Yr, "%Y-%M")
How can I get my date in the right format AND date type because I don't know how to get both, Thank you!
Here is some of my data
dates Country Specie median Month-Yr
1 2014-12-29 AT co 0.1 2014-06
2 2014-12-29 AT no2 15.780000000000001 2014-06
3 2014-12-29 AT pm10 20.8 2014-06
4 2014-12-29 AT pm25 69.5 2014-06
5 2014-12-29 AT so2 2.0 2014-06
6 2014-12-29 AU co 2.3333333333333335 2014-06
7 2014-12-29 AU neph 6.333333333333333 2014-06
8 2014-12-29 AU no2 4.314285714285714 2014-06