I got this problem. I have a data frame that has a date column. It's in characters, not date format. It has this ridiculous format that wrote as "yyyy.mm.dd". Yes you are reading it right, it has "." between year, month and day. Now I have to turn it into yyyy-mm-dd form and turn its data type to date. But the problem is that r doesn't recognise this form and won't let me turn it into the date data type. So I try to change the "." into "-" by using the code below:
recovered$Date <- str_replace_all(recovered$Date, '.', '-')
Or
recovered$Date <- gsub('.', '-', recovered$Date)
But the issue is, both of those codes turned every character in my date column into "-". So instead of turning "2020.01.01" into "2020-01-01", they were turned into "----------" for everyone in that column. Please help.