I have a dataset called verts
imported from Excel with a column called Date
that contains dates in this format: m/d/yyyy
. I'm trying to extract the year from this column.
Here's what I'm currently trying:
verts$Date_converted <- strptime(verts$Date, format = "%m-%d-%y")
verts$Year <- format(verts$Date_converted, "%y")
This produced two new columns in R, as you can see in the image, but both columns only contain NA
.
Any ideas on what I'm doing wrong?