I have a dataset, where I have converted hyperlinks into [url] - see example of posts at the bottom. I just wanted to count the frequency of the "[url]" by using R.
I have tried the following without success:
data = read.csv(X: ....... ,tweets.csv)
word_split= strsplit(USER_POST, " ")
sum(stringr::str_count(USER_POST, "[url]"))
I have also tried this
sum(stringr::str_count(USER_POST, "\\b[url]\\b"))
The result is 0. However, when I check in Excel, it appears around 7 times. Could anyone guide me about what I am doing wrong? Thank you in advance.
EDIT BELOW with further details:
USER_ID    USER_POSTS 
123        I like butterflies. 
234        I have found some information in this webpage [url] 
456        Find more information here [url] 
 
     
    