Hi all,
I have two sets: dig<-c("DAVID ADAMS","PIERS AKERMAN","SHERYLE BAGWELL","JULIAN BAJKOWSKI","CANDIDA BAKER") import<-c("by DAVID ADAMS","piersAKERMAN","SHERYLE BagWEL","JULIAN BAJKOWSKI with ","Cand BAKER","smith green") I want to get the following result from "import" after comparing the two sets result<-c("by DAVID ADAMS","piersAKERMAN","JULIAN BAJKOWSKI with ") I created a "partialmatch" function as follow, but can not get right result. partialmatch<- function(x, y) as.vector(y[regexpr(as.character(x), as.character(y), ignore.case = TRUE)>0]) result<-partialmatch(dig,import) [1] "by DAVID ADAMS" Thanks, lynn __________________________________________________________________________________ Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7. Enter now: http://au.docs.yahoo.com/homepageset/ [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.