0

I am trying to remove special characters from one column (tweets) in a big database. The code is as follows:

alltweets$clean_text <- str_replace_all(alltweets$text, "@\\w+", "")

Where alltweets is the name of my dataset. The error I get is the following:

Error in $<-.data.frame(*tmp*, "clean_text", value = character(0)) : replacement has 0 rows, data has 17410

I have tried to write tweets (the name of the column) instead of alltweets and the error shown is:

Error in stri_extract_all_regex(string, pattern, simplify = simplify, : object 'tweets' not found

I am trying to replicate this tutorial, but I have found it has small errors in the code. I have made the first part, but I am stocked with the cleaning text parts. The data is available for download online. I tried with several combinations of the signs to erase and the variable "nohandles" is created but it is empty. rpubs.com/cosmopolitanvan/r_isis_tweets_analytics

Nevermind, I solved it. Turns out the column name was wrong. Now I have some issues with the plot for positive and negative sentiments, but I guess I will have to create another question for that.

  • Could you show a small reproducible example and expected output using `dput`. Looks like one of the columns or objects are missing. Also the pattern should be `"[@]\\w+"` – akrun Jun 08 '17 at 07:05
  • @Sowndarya It is not clear why you changed the code `\w+` to `\\w+`. It is one of the problems in the code – akrun Jun 08 '17 at 07:26
  • Maybe share some of your data – Sotos Jun 08 '17 at 07:31
  • @Sotos I already commented to share some data, but looks like it is one of those postings – akrun Jun 08 '17 at 07:33
  • 1
    @akrun Yeah, I guess so. Oh well... It's up to them now – Sotos Jun 08 '17 at 07:43
  • I am trying to replicate this tutorial, but I have found it has small errors in the code. I have made the first part, but I am stocked with the cleaning text parts. The data is available for download online. I tried with several combinations of what you wrote and the variable "nohandles" is created but it is empty. http://rpubs.com/cosmopolitanvan/r_isis_tweets_analytics – kt_designbox Jun 09 '17 at 08:14

0 Answers0