Some of you might not be interested in text mining, but you still need to process text data in your day-to-day activities. In this section, we will try to give some examples that will be helpful for your daily needs. The following are the general tasks that we need to perform frequently:
Splitting the character string to get structured information
Matching certain parts of the characters to find out some patterns
Changing lowercase to uppercase, and vice versa
Calculating the number of characters in a string
Extracting a certain part from a string
Extracting only digits from a string
We will see an example for each case listed previously. First, we will remove a certain word from a string. To do so, we will use the textData
object. This object has two variables, and one of them contains text data. We will use the first observation from that text variable:
# Extracting first observation text2process <- textData...