Is there a quick way to calculate the difference in years between a) a date (data$First.Trading.Day) eg. "2016-02-09" and b) a year (data$Founding.Year) e.g. "1999"
I already did the following, but do not get to a correct result:
data$Age <- difftime(data$First.Trading.Day, data$Founding.Year, "years")
then I made a new column with only the year of the First trading date and tried this:
data$First.Trading.Year <- format(as.Date(data$First.Trading.Day),"%Y")
data$Age <- (data$First.Trading.Year) - (data$Founding.Year)
this gives me an error message
I would really appreciate some help!