1 year ago

#288868

test-img

RagnaN

Is there a way to return all tweets matching an element in a created vector?

I have a dataset where one variable is text from tweets (text). I want to detect all tweets matching at least one element in my vector (Ukr_words_MIX). Here is what I tried to do, using::rtweet, string_detect and apply

input

con_ukr_words_NOR <- df_A_NOR %>%
 mutate(text = tolower(text),
 lapply(x = Ukr_words_MIX, function(x){
 str_detect(string = text, pattern = x)})

output

> con_ukr_words_NOR <- df_A_NOR%>%
+   mutate(text = tolower(text),
+   lapply(x = Ukr_words_MIX, function(x){
+   str_detect(string = text, pattern = x)})
+ View(df_A)
Error: unexpected symbol in:
"  str_detect(string = text, pattern = x)})

Any ideas about what I am doing wrong?

Thank you!

r

sentiment-analysis

rtweet

0 Answers

Your Answer

Accepted video resources