#实现了单一模式匹配后,为实现总体的双组数据模糊匹配的进一步优化。
rm(list = ls())
library(tidyr)
library(dplyr)
library(lubridate)
library(rJava)
library(xlsxjars)
library(xlsx)
library(data.table)
library(readr)
library(readxl)
setwd('G:\\R\\data\\0423')
dir()
data1 <- read_excel('data1.xlsx')
data2 <- read_excel('data2.xlsx')
data1$bz <- 0
for(j in 1:nrow(data1)){
for (i in 1:nrow(data2)) {
if (grepl(pattern = data2$gysh[i],data1$gysh[j]) == TRUE){
data1$bz[j] <- i
print(i)
}
}
}