Reputation: 657
I'm running a script that I wrote about six months ago which, until now, has worked perfectly. The data looks something like this:
Speaker Consonant
cat c
dog g
pig h
cat c
And my code should create a new column, 'match', that decides whether there is a match between the speaker and the target consonant:
Speaker Consonant Match
cat c T
dog g T
pig h F
cat c T
The code I ran previously, using dplyr(), was
df %>% mutate(Match = stri_detect_regex(df$Speaker, df$Consonant))
Now when I run this I get the following error message:
Error in mutate_impl(.data, dots) :
Evaluation error: Missing closing bracket on a bracket expression. (U_REGEX_MISSING_CLOSE_BRACKET).
Note that my actual code is more complex, with 12 different commands in stri_detect_regex. But it all worked fine previously, and I get this error message even if I just run the first line of the code, as shown in the example code above.
Upvotes: 0
Views: 222
Reputation: 1950
I used stringr instead. Seems to work fine.
df <- data.frame(Speaker = c("cat", "dog", "pig", "cat"),
Consonant = c("c", "g" , "h", "c"))
library(stringr)
df %>% mutate(Match = str_detect(Speaker, Consonant))
Update: Your code also works for me with stringi
Upvotes: 1