I have strings in two datasets and i would like to do a partial match. Here is the code that I have written
df1 <- data.frame(A=c(.87,.11,.44,.45), B=c("I have a beard", "I slept for two hours", "I have had two courses","this is not true"))
df2 <- data.frame(X=c(127,10,433,344,890,4),Y=c("have","beard","syllabus","true","three","maths"))
I want to do a pmatch and I am expecting output as follows
A B X Y
.87 I have a beard 127 have
.11 I slept for two hours NA NA
.44 I have had two courses 127 have
.45 this is not true 344 true
I would like to a partial match with a left join on df1. I want to get the higher of the two matches(for example in "I have a beard" string "have" match has 127 and "beard" has 10 and i want to get the higher match. Any suggestions?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire