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 (,
If it is character class, you can try:
library(lubridate)
test <- c("u'9'", "u'2005'", "u'06'")
dym(paste(gsub("u|'", "", test), collapse = "/"))
[1] "2005-06-09 UTC"
Here I use lubridate to convert the string where I removed "u" and the ' character into time format.
The collapse character I used in paste is arbitrary, lubridate can handle pretty much anything as a separator between date parts.