I'm new to R and I have tried the search function but couldn't make much sense of what I found.
I have a string like this: 20/08/2016
How can I convert it to 20/08/16
Any help is much appreciated.
I'm new to R and I have tried the search function but couldn't make much sense of what I found.
I have a string like this: 20/08/2016
How can I convert it to 20/08/16
Any help is much appreciated.
Maybe you can try something like below
s <- "20/08/2016"
format(as.Date(s,"%d/%m/%Y"),"%d/%m/%y")
# [1] "20/08/16"
or
gsub("(.*/)\\d{2}(.*)","\\1\\2",s)
# [1] "20/08/16"