i'm having trouble tracking with what you're doing because you aren't formatting your code chunks as code. Give a try at using code formatting by putting triple ticks around your code (```)
Here's an example that might help:
library(tidyverse)
Chats <- data.frame(url=c('xxx','xxx','bobxxx','xxxbob','xxxbobxxx'))
Chats
#> url
#> 1 xxx
#> 2 xxx
#> 3 bobxxx
#> 4 xxxbob
#> 5 xxxbobxxx
Chats %>% mutate(fans = grepl('bob',url))
#> url fans
#> 1 xxx FALSE
#> 2 xxx FALSE
#> 3 bobxxx TRUE
#> 4 xxxbob TRUE
#> 5 xxxbobxxx TRUE
Chats %>% mutate(fans = case_when(grepl('bob',url) ~ 'Has bob',
!grepl('bob',url) ~ 'no bob')
)
#> url fans
#> 1 xxx no bob
#> 2 xxx no bob
#> 3 bobxxx Has bob
#> 4 xxxbob Has bob
#> 5 xxxbobxxx Has bob
Notice that the grepl returns only TRUE or FALSE. And I didn't use Chats$url because the pipe %>% is taking care of passing Chats into the function.
If I want to return a different value for when bob is present, then I have to use the case_when operator. Note that I use the ! to mean not.
Does that make sense?