I have a string variable that I want to parse to class Date
. In addition to the day, year and month, the format has other characters like separators (,
), letters and apostrophes (u''
), like this:
"u'9', u'2005', u'06'"
I have tried
as.Date(my_data$date, format = '%d %Y %m')
...but it only produces missing values. I was hoping that R would interpret the u''
as a unicode designator, which it doesn't.
How do I strip all those unused characters so that this "u'9', u'2005', u'06'"
becomes simply this "9 2005 06"
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…