Hello All,
I have a scenario I am facing.
I need to duplicate (replicate) certain rows in a DF I am working with.
Due to the sensitivity of the data I am working with, I provided a mock of what could be done with the output below.
employee <- c('John Doe','Peter Gynn','Jolie Hope')
salary <- c(21000, 23400, 26800)
startdate <- as.Date(c('2010-11-1','2008-3-25','2007-3-14'))
employ.data <- data.frame(employee, salary, startdate)
employee salary startdate
John Doe 21000 2010-11-01
Peter Gynn 23400 2008-03-25
Jolie Hope 26800 2007-03-14
My question is, lets say I want to duplicate the row of data pertaining to Peter Gynn in the output above.
So I would want two similar rows of data over Peter Gynn
How would I do that? I cannot seem to find the proper syntax to figure out this? I may also need to do it by a condition where if a row contains X or in this example, Peter Gynn in a column, make a duplicate row.
All the help is greatly appreciated.
Thank you so much!