Hello, I am pretty new to R and now I have the following problem:
I use the phonetic function from the stringdist package to remove the same names in a row with just spelling errors.
Example: See the first line
inventors = tibble::tribble(
~Inv1, ~Inv2, ~Inv3, ~Inv4, ~Inv5,
"BRAINT ANTOINE", "BRIANT ANTOINE", "SAUR ERWIN FRIEDRICH", NA, NA,
"DETLEF MUELLER", "DIRK MEYTHALER", "GEYER HARALD", "HARALD GEYER", "SAUR ERWIN"
)
head(inventors)
#> # A tibble: 2 x 5
#> Inv1 Inv2 Inv3 Inv4 Inv5
#> <chr> <chr> <chr> <chr> <chr>
#> 1 BRAINT ANTOINE BRIANT ANTOINE SAUR ERWIN FRIEDRICH <NA> <NA>
#> 2 DETLEF MUELLER DIRK MEYTHALER GEYER HARALD HARALD GEYER SAUR ERWIN
Created on 2021-05-29 by the reprex package (v2.0.0)
If I run the following code:
phonetic(inventors[1,])
I get something like
[1] "B653" "B653" "S665" NA NA
Now I want to go threw every row in my table and remove all the duplicates If there are any, but I only want to delete the duplicates for each row. If the same code appears in another row that's fine, just if its the same code multiple times in one table row.
I hope I could explain my problem and hope somebody can help me.
Thank you.