1

I am trying to test example code for fuzzywuzzyR, but I receive the error message:

Error in init$Extract(string = word, sequence_strings = choice, processor = PROC, : attempt to apply non-function.

I read a few things online that talked about having the correct version of python installed. When I check in R, mine says python 2.7. However, I am not familiar with python as I only use R. Do I need python for this? How can I change the version. An answer online said " As a quick fix, I changed the PATH variables to python 3.5 location and used pip to install Levenshtein and fuzzywuzzy. If R instance was running during this operation, then close and reopen R." But I don't know what this means - how do I change the PATH variable?

library(fuzzywuzzyR)

word = "new york jets"

choice = c("Atlanta Falcons", "New York Jets", "New York Giants", "Dallas Cowboys")

init_proc = FuzzUtils$new()
PROC = init_proc$Full_process
PROC1 = tolower

init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
init <- FuzzExtract$new()
init$Extract(string = word, sequence_strings = choice, processor = PROC, scorer = SCOR)
Maksym Fedorov
  • 6,383
  • 2
  • 11
  • 31
Caroline
  • 41
  • 3
  • Are you using Windows? – VFreguglia Feb 07 '19 at 14:06
  • re PATH: in case you use Windows: [for Win10](https://www.addictivetips.com/windows-tips/set-path-environment-variables-in-windows-10/). For Unix/Linux [this](https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux-unix) might help. – Shegit Brahm Feb 07 '19 at 14:15
  • No I'm using a mac – Caroline Feb 07 '19 at 14:23
  • @Caroline, I ported the fuzzywuzzy python library to R. You need to have python configured in your operating system and the error you receive appears when a user hasn't configured python correctly. There is a similar issue on the [Github package repository](https://github.com/mlampros/fuzzywuzzyR/issues/1). Feel free to open a new issue (if the previous issues are not helpful) by giving more details on the [R package repository](https://github.com/mlampros/fuzzywuzzyR/issues). – lampros Feb 08 '19 at 06:37

0 Answers0