The R code for transformation of the text is given below: toSpace <- content_transformer(function (x, pattern ) gsub(pattern, " ", x))ĭocs <- tm_map(docs, toSpace, <- tm_map(docs, toSpace, "\\|")Īfter removing the special characters from the text, it is now the time to remove the to remove unnecessary white space, to convert the text to lower case, to remove common stopwords like ‘the’, “we”. The output is not, however, produced here due to space constraintĪfter inspecting the text document (corpora), it is required to perform some text transformation for replacing special characters from the text. The R code for inspecting the text is given below: inspect(docs) Next use the function inspect() under the tm package to display detailed information of the text document. The R code for building the corpus is given below: docs <- Corpus(VectorSource(text)) The Corpus() function from text mining(tm) package will be used for this purpose. The ‘text’ object will now be loaded as ‘Corpora’ which are collections of documents containing (natural language) text. The R code for leading the text is given below: text <- readLines(file.choose()) ![]() The text file ( chicago) is imported using the following code in R. Loading the Required Packages: library("tm") Only two lecture notes – opening and closing address, will be used.īoth the lectures are saved in text file ( chicago). Here I’ve used the lecture delivered by great Indian Hindu monk Swami Vivekananda at the first World’s Parliament of Religions held from 11 to 27 September 1893. Preparing the Text Documents:Īs the starting point of qualitative research, you need to create the text file. ![]() The text mining package “(tm)” will be used for mining the text and the word cloud generator package (wordcloud) will be used for visualizing the keywords as a word cloud. R has very simple and straightforward approaches for text mining and creating word clouds. It is the visual representation of text data, especially the keywords in the text documents. It is method which enables us to highlight the most frequently used keywords in a paragraph of texts or compilation of several text documents. – Social science researchers use text mining approach for analysing the qualitative data. – Social media experts uses this technique to collect, analyze and share user posts, comments etc. – Politicians and journalists also use effectively the text mining to critically analyze the lectures delivered by the opposition leaders ![]() – Marketing managers often use the text mining approach to study the needs and complaints of their customers Some of typical usage of the text mining are mentioned below: More specifically, I’ll show you the procedure of analyzing text mining and visualizing the text analysis using word cloud. In this post, I’ll deviate from the pure statistical topics and will try to highlight some aspects of qualitative research. In the last two posts, I’ve focused purely on statistical topics – one-way ANOVA and dealing with multicollinearity in R.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |