What do you mean by this? Did you mean that after you run the code you quoted, if you run source
again, you get the previous source
? If that is the case, it's because you haven't assigned the results. Try with source <- source %>$ mutate(...)
, where ...
is the rest of the code and afterwards source
should get updated.
I can't help you with this.
It seems to work. Almost certainly you just copy-pasted my code in the console, and hence R
has no idea what is comment
object, and hence considers it as the function defined in base
package. That's not what I meant.
What I meant was to use it inside mutate
like the previous if_else
. Add a few rows with the comment
element being xxxxx
or zzzzz
and then if you use ... %>% mutate(Blank = if_else(((comment %in% list_of_no_comment_possibilities)|(str_detect(comment, "(.)\\1{4,}"))), 1, 0))
, it is supposed to work and it do work on my device.
(Note that I change 5
to 4
here, as using 5
will search for 1+5=6
identical characters. If you want to check for repetitions of some specific characters, i.e. you know for certain it'll be either x
or z
you can replace .
inside the parentheses)
If you can't do it, please provide a reproducible example showing your attempts at the problem and the errors you are facing.