{"id":1556,"date":"2016-11-02T14:21:24","date_gmt":"2016-11-02T21:21:24","guid":{"rendered":"https:\/\/blogs.ubc.ca\/coetoolbox\/?page_id=1556"},"modified":"2016-11-07T11:49:40","modified_gmt":"2016-11-07T18:49:40","slug":"text-mining-in-r","status":"publish","type":"page","link":"https:\/\/blogs.ubc.ca\/coetoolbox\/bams580d\/text-analytics\/text-mining-in-r\/","title":{"rendered":"Text mining in R"},"content":{"rendered":"<p>For a mark of up to 85%, produce a document (Word, html, or pdf) using R Markdown that does what we did in class:<\/p>\n<ul>\n<li>load any packages you need<\/li>\n<li>read in the review data set [subset of Yelp dataset challenge]<\/li>\n<li>flag each review as &#8220;positive&#8221; or &#8220;negative&#8221; sentiment<\/li>\n<li>make a corpus out of the whole set of texts and clean as needed<\/li>\n<li>make a document term matrix out of the corpus<\/li>\n<li>generate a word cloud: use your judgement about how many words to include or what minimum frequency to require, and state your observations about the word cloud.<\/li>\n<li>generate a comparison word cloud for positive and negative reviews\n<ul>\n<li>first make two documents, one containing the text of all negative reviews and one containing the text of all positive reviews<\/li>\n<li>then make those two documents into a corpus<\/li>\n<li>then make a term document matrix out of that corpus<\/li>\n<li>state your observations about the comparison word cloud<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>For a mark of up to 100%, go deeper! See what else you can learn about the Yelp data. (If you like, you can go back to the full Yelp dataset and select a different subset&#8211;the files I used for cleaning and pre-processing are in the shared folder W:\\SAUD\\COE\\coeprojects\\_Resources-Tutorials\\BAMS 580D 2016\\text analytics\u00a0. You could also get a completely different data set: Twitter is one of the easiest sources; see instructions <a href=\"https:\/\/blogs.ubc.ca\/coetoolbox\/bams580d\/python-basics\/twitter-mining-with-python\/\">here<\/a>. Just make sure that what you&#8217;re planning is realistic. You could submit something basic for this assignment, and then enter the Yelp dataset challenge for real later.)<\/p>\n<p>You need to do some text analytics, but it&#8217;s fine to also do analysis on other structured data like rating or location or type of restaurant. Some ideas for questions you could ask about the Yelp data:<\/p>\n<ul>\n<li>Do people use different words about pizza restaurants than about sushi restaurants?<\/li>\n<li>How do individual users&#8217; average ratings compare? are some users habitually more negative than others?<\/li>\n<li>What words occur most often in reviews that are flagged with anger, anticipation, disgust, and other specific emotions?<\/li>\n<li>How do different emotions correlate with a user&#8217;s star rating of a particular restaurant?<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>For a mark of up to 85%, produce a document (Word, html, or pdf) using R Markdown that does what we did in class: load any packages you need read in the review data set [subset of Yelp dataset challenge] flag each review as &#8220;positive&#8221; or &#8220;negative&#8221; sentiment make a corpus out of the whole [&hellip;]<\/p>\n","protected":false},"author":22979,"featured_media":0,"parent":1554,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1556","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages\/1556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/users\/22979"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/comments?post=1556"}],"version-history":[{"count":2,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages\/1556\/revisions"}],"predecessor-version":[{"id":1562,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages\/1556\/revisions\/1562"}],"up":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages\/1554"}],"wp:attachment":[{"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/media?parent=1556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}