In Chapter 3, Data Wrangling with R, we approached the topic of data cleaning (munging). Data cleaning is so important that the majority of data scientists spend most of their work time cleaning and preparing data. The last session, What is the R community tweeting about?, gave us a DataFrame with 15999 rows and 42 columns. That is raw data. This session will clean and transform it.
Our initial goal was to check which packages the R community is talking about on Twitter. There are three variables we will use to achieve the final goal.
The variable text can be truncated when there is a retweet. When that is the case, check retweet_text, which won't be truncated. The quoted_text variable also brings useful information. To unite all the useful information into a single object, we can use the following code:
quotes <- tweets_dt$is_quote
rts...