Book Image

R Data Mining

Book Image

R Data Mining

Overview of this book

R is widely used to leverage data mining techniques across many different industries, including finance, medicine, scientific research, and more. This book will empower you to produce and present impressive analyses from data, by selecting and implementing the appropriate data mining techniques in R. It will let you gain these powerful skills while immersing in a one of a kind data mining crime case, where you will be requested to help resolving a real fraud case affecting a commercial company, by the mean of both basic and advanced data mining techniques. While moving along the plot of the story you will effectively learn and practice on real data the various R packages commonly employed for this kind of tasks. You will also get the chance of apply some of the most popular and effective data mining models and algos, from the basic multiple linear regression to the most advanced Support Vector Machines. Unlike other data mining learning instruments, this book will effectively expose you the theory behind these models, their relevant assumptions and when they can be applied to the data you are facing. By the end of the book you will hold a new and powerful toolbox of instruments, exactly knowing when and how to employ each of them to solve your data mining problems and get the most out of your data. Finally, to let you maximize the exposure to the concepts described and the learning process, the book comes packed with a reproducible bundle of commented R scripts and a practical set of data mining models cheat sheets.
Table of Contents (22 chapters)
Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
14
Epilogue

Developing wordclouds from text


We can make our first attempt to look at these words using the wordcloud package, which basically lets you obtain what you are thinking of: wordclouds.

To create a wordcloud, we just have to call the wordcloud() function, which requires two arguments:

  • words: The words to be plotted
  • frequency: The number of occurrences of each word

Let's do it:

comments_tidy %>%
count(word) %>%
with(wordcloud(word, n))

Reproduced in the plot are all the words stored within the comments_tidy object, with a size proportionate to their frequency. You should also be aware that the position of each word has no particular meaning hear.

What do you think about it? Not too bad, isn't it? Nevertheless, I can see too many irrelevant words, such as we and with. These words do not actually convey any useful information about the content of the comments, and because they are quite frequent, they are obscuring the relevance of other, more meaningful, words.

We should therefore remove them...