dgrtwo / fuzzyjoin

Join tables together on inexact matching
Other
668 stars 61 forks source link

error when one dataframe only has one column #13

Closed mgacc0 closed 8 years ago

mgacc0 commented 8 years ago

When trying to join two dataframes, if one of the dataframes has only one column an error happens:

stringdist_inner_join(df1, df2) Error: cannot convert object to a data frame

Maybe it's dropping one dimension (from dataframe with one column to vector)?

dgrtwo commented 8 years ago

I cannot reproduce. For example the following works:

library(dplyr)
library(fuzzyjoin)
d1 <- data_frame(a = c("apple", "banana"))
d2 <- data_frame(b = c("appl", "banan"))
stringdist_inner_join(d1, d2, by = c("a" = "b"))

Could you provide a reproducible example, as well as the output of sessionInfo()?

mgacc0 commented 8 years ago

Of course:

  df1 <- structure(list(
    nome = c("AZUCENA MONTOYA ROMERO", "TRINIDAD BORJA BORJA")),
    .Names = c("nome"), row.names = 94:95, class = "data.frame") 

  df2 <- structure(list(NOME2 = c("AZUCENA MONTOYA ROMERO", "SHEILA REFOJO FURELOS"),
                        EXPEDIENTE = c("15030/2450/12", "15030/2456/12")),
                   .Names = c("NOME2", "EXPEDIENTE"), row.names = 1163:1165, class = "data.frame")
  stringdist_inner_join(df1, df2, by=c("nome"="NOME2"), max_dist=2)

Thanks in advance :)

dgrtwo commented 8 years ago

Fixed, thanks!