I have a data frame. Here is a sample part.
Lines <- "Category date
desktop 2017-12-25
tablet 2016-05-13
desktop 2018-06-01
desktop 2017-08-06
tablet 2015-12-31"
DF <- read.table(text = Lines, header = TRUE)
DF$date <- as.Date(DF$date)
There are more than 1000 rows in the data frame.
What I would like to do is: if the category is desktop, how can I add 2 years to the existing date? If the category is tablet, how can I add only 1 year to the existing date? Thank you for the help!