用特定日期替换多个值

时间:2019-06-13 08:25:48

标签: r replace

我在R中有一个数据帧,该数据帧的列的值从1到711。每个值重复多次。我想将每个值替换为特定的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"

0 个答案:

没有答案