I have the following code:
x <- data.frame("SN" = 1:2, "Name" = c("aaa","bbb"))
y <- data.frame("SN" = 1:2,  "Name" = c("aa1","aa2"))
x$partials<- as.character(sapply(x$Name, agrep, y$Name,max.distance = 1,value=T))
x
The output is the following:
    > x
  SN Name        partials
1  1  aaa c("aa1", "aa2")
2  2  bbb    character(0)
However I am expecting the following output:
Any ideas?

 
    