I need to map 3-4 different dataframes that have different date formats. How can we convert date in format:
YYYY-MM-DD
to character in the form
Create a date object from the string (skip this if your column is already in the Date format):
original_date <- as.Date("2017-07-19", "%Y-%m-%d")
Then format the original date to the new format:
format(original_date, "%b-%y")
# "Jul-17"
The %b
indicates the 3-letter abbreviation of the month and %y
is the year without the century. You can find more of these codes and their meaning here: http://strftime.org/