I have a column of datetime with values like 10/10/49 20:30, but need to mutate the dataframe to have a column of just the date in format 1949. The code below is just bringing me a column of NA. How can I extract the year? I need to use dplyr to solve this!
df %>%
mutate(., year = format(as.Date(x = datetime, format="%d/%m/%y %I:%M:%S %p"),"%Y"))