Performing network analysis on textual data
One hypothesis we could make is that these companies, or at least a good part of them, are from the same industry. Is that true?
We actually have the data to figure this out. If we look back at our information
dataset, we can easily see that some of the records start with the industry
token. These are the records reproducing the line related to the customer's industry, which is contained within every customer card.
Let's filter out all the other records to retain only those records that specify the industry of the company:
information %>% filter(grepl("industry", text))
This is fine; nonetheless, we still have that industry
: token, which is meaningless. Let's remove it by using the gsub()
function. This function basically substitutes a pattern with a replacement within a character vector. Therefore, to apply it, you have to specify the following:
- The pattern to look for, through the argument pattern
- The replacement to put where the pattern is found...