replacing multiple values with a specific date

by Rohan Bali   Last Updated June 13, 2019 08:26 AM

I have a data frame in R with a column with values from 1 to 711. Each value is repeated multiple times. I want to replace each value with a specific DATE.

df <- data.frame(col1 = c(1,1,1,1,1,2,2,2,4,5,5,2,3) #711 values and total 
      entries = 300000
df1 <- data.frame(col2 = c("01-01-2014","02-01-2014","03-01-2014",04-01- 
       2014","05-01-2014") #711 unique dates

#Value 1 should be replaced by "01-01-2014"
#Value 2 should be replaced by "02-01-2014"
#......
#Value 711 should be replaced by "12-12-2015"
Tags : r replace


Related Questions


Updated October 08, 2017 09:26 AM

Updated December 21, 2018 07:26 AM

Updated January 13, 2017 01:11 AM

Updated January 29, 2019 10:26 AM