For this assignment we needed to find an additional 8 yelp reviews on a resturaunt and add them to the existing 42 in a .csv file and then do some text mining.
library(textir)
## Warning: package 'textir' was built under R version 3.4.2
## Loading required package: distrom
## Warning: package 'distrom' was built under R version 3.4.2
## Loading required package: Matrix
## Loading required package: gamlr
## Warning: package 'gamlr' was built under R version 3.4.2
## Loading required package: parallel
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.4.2
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:distrom':
##
## collapse
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(stringr)
library(tidytext)
## Warning: package 'tidytext' was built under R version 3.4.2
rest<-read.csv("~/Business Analytics/Yelp Reviews Fall2017.csv")
rest
## Restauraunt X5StarRating
## 1 O<U+0092>Gara<U+0092>s Bar And Grill 4
## 2 O<U+0092>Gara<U+0092>s Bar And Grill 2
## 3 O<U+0092>Gara<U+0092>s Bar And Grill 1
## 4 O<U+0092>Gara<U+0092>s Bar And Grill 3
## 5 O<U+0092>Gara<U+0092>s Bar And Grill 1
## 6 O<U+0092>Gara<U+0092>s Bar And Grill 4
## 7 O<U+0092>Gara<U+0092>s Bar And Grill 4
## 8 Butcher & The Boar 5
## 9 Butcher & The Boar 5
## 10 Butcher & The Boar 4
## 11 Butcher & The Boar 5
## 12 Butcher & The Boar 3
## 13 Butcher & The Boar 5
## 14 Butcher & The Boar 5
## 15 112 Eatery 5
## 16 112 Eatery 4
## 17 112 Eatery 5
## 18 112 Eatery 5
## 19 112 Eatery 4
## 20 112 Eatery 5
## 21 112 Eatery 5
## 22 Hell's Kitchen 5
## 23 Hell's Kitchen 1
## 24 Hell's Kitchen 2
## 25 Hell's Kitchen 4
## 26 Hell's Kitchen 2
## 27 Hell's Kitchen 4
## 28 Hell's Kitchen 5
## 29 Bar La Grassa 5
## 30 Bar La Grassa 5
## 31 Bar La Grassa 4
## 32 Bar La Grassa 5
## 33 Bar La Grassa 4
## 34 Bar La Grassa 5
## 35 Bar La Grassa 5
## 36 The Lowry 5
## 37 The Lowry 5
## 38 The Lowry 5
## 39 The Lowry 4
## 40 The Lowry 3
## 41 The Lowry 5
## 42 The Lowry 5
## 43 The Nook 5
## 44 The Nook 4
## 45 The Nook 5
## 46 The Nook 5
## 47 The Nook 2
## 48 The Nook 4
## 49 The Nook 5
## 50 The Nook 4
## Review
## 1 "My hubbie and I walked over after a long day of work in and out of the house. I was hungry for a burger. I almost never have a burger. When I do I'm often disappointed. Not tonight. I had the jalapeno business. It was juicy and delicious. The waiter was attentive, nice looking too :) It's a bit expensive, but most places are for someone who usually cooks"
## 2 "It's ok. Been there three times, and underwhelmed with their food. Nice tap beer selection however."
## 3 "Nasty rude staff. I was recently accosted by a woman who came outside while I was taking a smoke break from my overpriced drink"
## 4 " I had fish and chips the first time that I was there and corned beef and cabbage the second time...both were ehhh. Fish and chips were crispy though which is a plus, not greasy, and the corned beef and cabbage was a little blah. Keep in mind that this was during their week of specials, so maybe it wasn't typical of their regular "
## 5 "It smells like a porta potty inside. The staff comes off very dull and lifeless. But I got to meet the local drunk! That was definitely the only highlight of this place. Typical bad Irish bar."
## 6 "I was surprised by how good the food was - I honestly expected some boring bar food, but the Jalapeno Business burger was killer good. I don't even like french fries, but I loved these."
## 7 "I did not notice the smell. The shepherds pie was great. Beer selection phenomenal. This place had a sense of being a neighborhood bar."\nService was good.
## 8 "I've eaten here several time over the years. Always go back when downtown for an event or when the weather starts to cool down and I need to warm up!"
## 9 "We had a really great dining experience here. A few of us out-of-towners met up with some local friends at Butcher & The Boar (their recommendation). We were among the first few people to walk in just after they opened and the place filled up fast."
## 10 "I'd give this place 5 stars, except in a week moment I ordered the crab legs. They looked impressive when the arrived at the table, but they were not tasty: my colleagues said, Who orders crab in Minneapolis anyway? They're right, but still ..."
## 11 "I had my own combo with a group here. Service was awesome. And the cap of smoked beef I had was one of the finest things I've ever tasted. Ever. Really. We had virtually every side as well. All of them were fine, but that beef! And we did indulge in a few sausage plates for our group to share. They were spicy and salty and delicious. I'm glad I don't live in Minneapolis nor can I afford this place often. I'd be dead from overeating. But I'd be a smiling corpse!"
## 12 "Charcuterie plate: this felt like a deconstructed banh mi (Vietnamese baguette sandwich), minus the bread. Nothing really stuck out as special. The head cheese had little flavor. The smoked turkey pate was not too bad. The elk was not memorable. Glad I tried, but probably wouldn't recommend this as it fell short of expectations.. Especially with all these reviews and high ratings.."
## 13 "Finally had the chance to visit this iconic restaurant in downtown Minneapolis. Butcher & The Boar was a solid, American restaurant. Followed recommendations of fellow Yelpers and had a great experience. "
## 14 "Beer-battered french fries and ultra cheesy croquettes. What better late-night snack food is there? We sat at the bar last Saturday night, had some wine, met a few, friendly regulars and made jokes with the bartenders. I would love to go back for a full meal, but the french fries and croquettes were divine."
## 15 "I came here for a birthday celebration while in town. Everything was spectacular. We got three dishes to split among two people and it was the perfect amount. We ordered the lamb pasta dish, fried bread with prosciutto, and gnocchi. It was all delicious, but especially the lamb and the gnocchi."
## 16 "Food was 5 stars but service was only 3. Loved the food but disappointed in the service. I felt like the waitress treated us like we weren't good enough to be there."
## 17 "This place was really cool - ambience was very romantic and intimate - the place is smaller than I expected which was lovely. Now, onto the good stuff - good! Olives and candied almonds greeted us - tasty. The menu is similar to Bar LaGrassa - smaller plates, then a few main courses, then sides."
## 18 "It has been way too long since I have enjoyed this spot. I went recently to celebrate my wedding anniversary with my husband. I have not been here for a few years as I have been making my way around town tasting what Minneapolis & St. Paul chefs have to offer. But, my fond memories of this place brought me back here and they did not disappoint tonight!"
## 19 "Really great food and terrific service. The pasta is freshly made and definitely on point. Fresh and yummy ingredients. The ambience is a bit cramped. Definitely didn't feel like fine dining but more than a decent option in Minneapolis. Not sure why it gets such glowing reviews however."
## 20 "We had the Scallops and Tagliatelle with Foie Gras Meatballs and it was all DELICIOUS! We are at the upstairs bar and the old fashioned' Swede delicious as well!"
## 21 "I've eaten here many times but not in several years. I have always loved this place and about 7-8 years ago it was the hottest place in town and hard to get a reservation. Now that's a little easier but it's still bustling."
## 22 "Hell yes! Great vibe, live music, amazing menu. No brainer, definitely come for brunch or grab a sandwich. Make a reservation for the weekends or try your luck grabbing a stool at the bar for one or two. I'm in Minneapolis in Business and was tired of strip mall food. And Hell answered my prayers. Haha."
## 23 "Place smells like old bar smell.... So why didn't we walk out? The reviews, people were nice and the menu was intriguing so had to stick it out. Benefit of the doubt sort of thing."
## 24 "While the staff were great, the food really did not leave up to its hype, as is the story with many of these highly-reviewed restaurants. I got the Juicy Loosy burger which Minneapolis is known for, the lemon ricotta pancakes and the Caesar salad. The burger was SO disappointing - the patty was so dry! The pancakes were forgetful. Gotta say though that I was impressed with the salad. It tasted super fresh and the Caesar dressing was incredibly flavorful with a hints of lemon and anchovies."
## 25 "I enjoyed the theme and ambiance. Food was really good also. We went at around 12pm brunch time on a Sunday on the weekend before Halloween!"
## 26 "But the food was unsatisfactory. I ordered the Bison Egg Benedict and substituted the hashbrowns for a mixed greens salad. The bison benedict was drowning in the lukewarm jalapeno-hollandaise sauce, so was hard to eat, but I was mostly disappointed with the bison itself. The menu indicated that it would be cooked to medium-rare, which is how I prefer my meat, but it unfortunately, was overcooked - so the texture was rough to cut and chew. I was not impressed. At least the poached egg had that runny yolk once I cut into it, and did like the greens with a pear vinaigrette, making the dish lighter. But I would not recommend this dish, given the overcooked bison, drenched in the hollandaise sauce. "
## 27 "Tried this spot after the Vikings game this past weekend on the recommendation of a friend who raved about it. And it didn't disappoint. Cool spot underground in downtown Minneapolis. We sat on the bar side. Really cool décor. They have a good tap selection of local Minnesota craft beers, and a special "secret beer" for $2 each day where you don't know what you are getting until it is served. My buddy Bob tried ordering it but was swayed not to by our waiter as he noted "it wasn't very good and your not going to like it". Cheers to honesty!"
## 28 "Stopped in for Saturday breakfast on recommendation from Renaissance hotel staff. Wait time was 30 min, but they do take reservations. They had great live music, patrons clapping and dancing, the waitress was very nice and attentive, the food was really good (4 stars) but the overall experience was 5 star all the way. It's a fun place with quirky decor. Would go back again without hesitating."
## 29 "I had an excellent time here with great service and delicious food. Only downside was waiting 45 minutes for a table but that's gonna happen when the food is THIS GOOD."
## 30 "If you're in the mood for a calm place to sit down, relax and enjoy some exquisite Italian food then Bar La Grassa is one establishment that will not disappoint. The cozy and modern atmosphere with its warm lighting sets the stage to loosen up and enjoy a fabulous night with dinner and drinks. A perfect setting for those on a first date (where I saw a couple tables way too tense and clearly on a first date....yea I like to people watch. So?"
## 31 "I see the hype surrounding Bar La Grassa - their food is fantastic! To start, we had the Soft Eggs & Lobster Bruschetta and my God- that ish was so damn good. It was as soft as I'd imagine the clouds in heaven would be. It's quite pricy for the size (and as an app in general) to be honest, but if you're willing to splurge, you'll be well rewarded for it. For dinner, I had the Gnocchi with cauliflower and orange. Loved it! Great texture, soft, and flavorful- though I wish it had weaker notes of the orange to it, but that's just me. For dessert, we had the salted caramel crespelle (good, but overly heavy on the caramel flavor) and the coconut lime panna cotta (lets just say it wasn't for me. Too tart). We'll probably skip dessert next time, but the pasta (and the soft eggs and lobster)!? Oooooh wwweeeee. We'll be back."
## 32 "Amazing atmosphere and food! Great spot for a date night or for a group dinner. This spot is so good I CRAVE their pasta. You must get the Tuna calamarata and you can't get anything like the orange gnocchi anywhere else. Service is top notch. If you're going with a group you'll definitely need to make a reservation. "
## 33 "I was very excited to try Bar La Grassa and was impressed by the food and our server. The other staff seemed a bit cold. My husband liked the pork and I enjoyed the eggs and lobster although there wasn't much lobster for the $20. The entrees were all excellent and for dessert we enjoyed the Crespelle the best. The Bellinis were also excellent. Pricey dinner for the amount of food."
## 34 "This place is incredible - from the ambience to the wait staff to the food you just can't go wrong! The soft egg and lobster bruschetta is just plain stupid good - seriously it's like heaven on a plate. The spaghetti with brown butter and lobster can't be described you just have to come and taste it. The salted caramel crepes are literally everything you could want in a dessert - come here - right now!"
## 35 "Ummm if you don't eat here when you're in Minneapolis, you're definitely missing out. Make sure to order the pasta negra! DELICIOUS. I have to say the pasta here is on par, if not, better than what I've had in Italy! Needless to say, pretty impressed. Also tried the bruschetta with carpaccio--amazing. Never had steak carpaccio sliced so thick; they literally give you slabs!"
## 36 "This is my favorite brunch venue. I don't think there is a single breakfast item on the menu that I dislike. But I still always order the oatmeal pancakes. They are THE BEST. They are also super yummy as cold leftovers, FYI."
## 37 "Great all around restaurant to bring friends and family. I've had both brunch and dinner here and were very much pleased both times by the food and service. Their bloody marys are perfection here with their great blend of seasonings, alcohol, and fixings (that jalapeno cheese cube... yasss). I'm keto/low carb and they were able to substitute the hashbrowns and toast with a delicious side salad with no extra charge alongside my Denver frittata which was also full of cheesy goodness."
## 38 "New to the Minneapolis area and it was our first time here! Absolutely wonderful! They were so helpful and brought us their favorite things to try! Honestly I'm so relieved to find a place so welcoming and delicious close to our new home! Special shout out to our waiter JJ!! Thank you"
## 39 "I liked my food and the service was great. Too often you have to ask for your free refills of Diet Coke, and that's not right. Here, that's not the case. I ordered the beet salad and found it spot on. Great flavors, fresh, and delightful! We ordered the deviled eggs as an appetizer, which were good (if you're a fan of curry)."
## 40 "Service is great. Food is subpar. I was here a few weeks ago and had their eggs Benedict which I enjoyed. This time around I had their chicken and waffles and it was good if you like chicken nuggets and waffles which is pretty basic. The "gravy" was basically a house sauce that was complimentary and would've been better on the side or not on the dish at all. I'm from the south and keeping it simple makes chicken and waffles that much better. Also had the deviled eggs which I thought was extra as far as what was on it and the side sauce that they spread on the side. Felt like they were trying to hard to make something simple into something unique. Beer selection is good. Very accommodating for larger parties. Waiters/waitresses are polite and professional. I probably won't come back for food but that's just my opinion. Service is great if that's what you're looking for."
## 41 "If you want a good, classic brunch or breakfast this is the place to go in Uptown! The entire Blue Plate chain of restaurants knows how to have their own twist on their menus and The Lowry is definitely feel-good-food meets home cooking."
## 42 "It's been a year. But we came back for a wedding anniversary lunch. The food was SO great!!! And we really like the casual atmosphere so you can relax, kick back, and enjoy yourself. I also like that you can always find off-street parking, despite being so close to Uptown and Downtown."
## 43 "This has been on my radar for awhile now and it did not disappoint! I got the Paul Moliter which is a pepper jack cheese stuffed burger that was perfectly cooked medium with fried onions on top, yum. Cut in half, the cheese was just oozing out. What I appreciated the most about this burger was how a clean eat it was. Some people like to dig in and say the messier the better, but I prefer my burger less greasy, my bun not wet and my white shirt that day to stay white. I also changed my fries to sweet potato fries which came with a chipotle mayo dipping sauce. So worth the extra price. My group of friends also shared two baskets of honey bacon cheese curds. Definitely worth the calories for that item."
## 44 "The service is so great I love how friendly they are and the food omg is to lick your fingers. I ordered the one of the stuffed burgers the guy burger u know the guy with that spikes hair from tv omg order that one u won't regret it has so much flavors and texture it ozzies of cheese if your a onion ring fan like me instead of fries sub for the onion rings a dollar more. \nIt also very affordable for two people and two beers came to 38 my husband had a corona and I had a baby drink a apple orchard "
## 45 "I've been here a few times, with the kids, with with wife, on my own, I tried several of the burgers, but I've never wondered too far. The onion rings, waffle fries, cheese curds, fried pickles were all great! Seriously good, they use quality ingredients and care to cook them. The burgers are the the real star of the show!\n"
## 46 "I've had stuffed burgers, and then there's this place with its overflowing stuffed burger. Guy's burger, a great start if you're not familiar with this place. Really delicious, and I'm sad there's not one like this where I'm really from."
## 47 "After so looking forward to gorging myself with a juicy nookie we were left disappointed and unsatisfied. Spanish fly - lacked flavor and the cheese wasn't warm. However the chips were great! Juicy Nookie - Cheese was cold...isn't the point of that burger the cheese! BOO! I should have sent it back."
## 48 "This place has amazing burgers! The service is a little slow. Apparently If you order the most common types of beer, they have to go downstairs to the bowling alley to get the beer. If they had quicker service, this place would be a 5 all the way. The food was exceptional. It's sad we do not have something like this in Omaha."
## 49 "I have been on a mission for the best Juicy Lucy, and this was my second stop, and while I will continue to keep trying, it might not get any better than this place. Perfect dive bar to start and the juiciest juicy Lucy a girl could ask for. Service was great and a lot faster than Matt's Bar."
## 50 "The burger was really good- I wanted to try the the "Juicy Nookie" as a burger like that is not available in SoCal. It was not overly greasy, was not overly seasoned, it was just a good solid burger. Fries were good too! I would definitely come again- and to me that is the ultimate test of a place."
dim(rest)
## [1] 50 3
head(rest)
## Restauraunt X5StarRating
## 1 O<U+0092>Gara<U+0092>s Bar And Grill 4
## 2 O<U+0092>Gara<U+0092>s Bar And Grill 2
## 3 O<U+0092>Gara<U+0092>s Bar And Grill 1
## 4 O<U+0092>Gara<U+0092>s Bar And Grill 3
## 5 O<U+0092>Gara<U+0092>s Bar And Grill 1
## 6 O<U+0092>Gara<U+0092>s Bar And Grill 4
## Review
## 1 "My hubbie and I walked over after a long day of work in and out of the house. I was hungry for a burger. I almost never have a burger. When I do I'm often disappointed. Not tonight. I had the jalapeno business. It was juicy and delicious. The waiter was attentive, nice looking too :) It's a bit expensive, but most places are for someone who usually cooks"
## 2 "It's ok. Been there three times, and underwhelmed with their food. Nice tap beer selection however."
## 3 "Nasty rude staff. I was recently accosted by a woman who came outside while I was taking a smoke break from my overpriced drink"
## 4 " I had fish and chips the first time that I was there and corned beef and cabbage the second time...both were ehhh. Fish and chips were crispy though which is a plus, not greasy, and the corned beef and cabbage was a little blah. Keep in mind that this was during their week of specials, so maybe it wasn't typical of their regular "
## 5 "It smells like a porta potty inside. The staff comes off very dull and lifeless. But I got to meet the local drunk! That was definitely the only highlight of this place. Typical bad Irish bar."
## 6 "I was surprised by how good the food was - I honestly expected some boring bar food, but the Jalapeno Business burger was killer good. I don't even like french fries, but I loved these."
length(rest$Review)
## [1] 50
We started by downloading our packages, reading in the file, looking at the summary, and checking how many rows of data we had, which is 50.
rest_df<-data_frame(line=1:50,text=as.character(rest$Review))
rest_df
## # A tibble: 50 x 2
## line
## <int>
## 1 1
## 2 2
## 3 3
## 4 4
## 5 5
## 6 6
## 7 7
## 8 8
## 9 9
## 10 10
## # ... with 40 more rows, and 1 more variables: text <chr>
tidy_rest<-rest_df %>% unnest_tokens(word,text)
tidy_rest
## # A tibble: 3,054 x 2
## line word
## <int> <chr>
## 1 1 my
## 2 1 hubbie
## 3 1 and
## 4 1 i
## 5 1 walked
## 6 1 over
## 7 1 after
## 8 1 a
## 9 1 long
## 10 1 day
## # ... with 3,044 more rows
data(stop_words)
tidy_rest<-tidy_rest %>% anti_join(stop_words)
## Joining, by = "word"
We just got rid of extra words that will appear often like “and”, “to”, “as”, etc. This will help us just look at the words with meaning to us.
tidy_rest
## # A tibble: 1,108 x 2
## line word
## <int> <chr>
## 1 1 hubbie
## 2 1 walked
## 3 1 day
## 4 1 house
## 5 1 hungry
## 6 1 burger
## 7 1 burger
## 8 1 disappointed
## 9 1 tonight
## 10 1 jalapeno
## # ... with 1,098 more rows
tidy_rest %>% count(word,sort=TRUE)
## Warning: package 'bindrcpp' was built under R version 3.4.2
## # A tibble: 670 x 2
## word n
## <chr> <int>
## 1 food 28
## 2 burger 15
## 3 service 15
## 4 bar 14
## 5 cheese 10
## 6 delicious 10
## 7 minneapolis 10
## 8 time 9
## 9 fries 8
## 10 beer 7
## # ... with 660 more rows
rest_joy <-get_sentiments("nrc") %>%
filter(sentiment=="joy")
rest_joy
## # A tibble: 689 x 2
## word sentiment
## <chr> <chr>
## 1 absolution joy
## 2 abundance joy
## 3 abundant joy
## 4 accolade joy
## 5 accompaniment joy
## 6 accomplish joy
## 7 accomplished joy
## 8 achieve joy
## 9 achievement joy
## 10 acrobat joy
## # ... with 679 more rows
Now we filtered the words to look for words with positive connotation.
tidy_rest %>% inner_join(rest_joy) %>% count(word, sort=TRUE)
## Joining, by = "word"
## # A tibble: 44 x 2
## word n
## <chr> <int>
## 1 food 28
## 2 delicious 10
## 3 beer 7
## 4 enjoy 3
## 5 excellent 3
## 6 perfect 3
## 7 special 3
## 8 favorite 2
## 9 friendly 2
## 10 glad 2
## # ... with 34 more rows
library(wordcloud)
## Warning: package 'wordcloud' was built under R version 3.4.2
## Loading required package: RColorBrewer
tidy_rest %>% anti_join(stop_words) %>% count(word) %>% with(wordcloud(word,n,max.words=50))
## Joining, by = "word"
library(reshape2)
## Warning: package 'reshape2' was built under R version 3.4.2
tidy_rest %>%
inner_join(get_sentiments("bing")) %>%
count(word,sentiment,sort=TRUE) %>%
acast(word~sentiment,value.var="n", fill=0) %>%
comparison.cloud(colors=c("gray20","gray80"),max.words=100)
## Joining, by = "word"
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): indulge could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): lacked could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): lifeless could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): lukewarm could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): nasty could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): needless could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): overpriced could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): pricey could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): regret could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): rough could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): rude could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): slow could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): smoke could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): split could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): stupid could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): tense could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): tired could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): twist could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): unsatisfactory could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): weaker could not be fit on page. It will not be plotted.
## Warning in comparison.cloud(., colors = c("gray20", "gray80"), max.words =
## 100): wrong could not be fit on page. It will not be plotted.
This command just created a wordcloud with positive words on one end and negative words on the other to help visualize the reviews. Also the larger words were more common than the smaller words.
rest_bigrams<-rest_df %>% unnest_tokens(bigram,text,token="ngrams",n=2)
rest_bigrams
## # A tibble: 3,004 x 2
## line bigram
## <int> <chr>
## 1 1 my hubbie
## 2 1 hubbie and
## 3 1 and i
## 4 1 i walked
## 5 1 walked over
## 6 1 over after
## 7 1 after a
## 8 1 a long
## 9 1 long day
## 10 1 day of
## # ... with 2,994 more rows
library(tidyr)
## Warning: package 'tidyr' was built under R version 3.4.2
##
## Attaching package: 'tidyr'
## The following object is masked from 'package:reshape2':
##
## smiths
## The following object is masked from 'package:Matrix':
##
## expand
bigrams_separated<-rest_bigrams %>% separate(bigram,c("word1","word2"),sep=" ")
bigrams_separated
## # A tibble: 3,004 x 3
## line word1 word2
## * <int> <chr> <chr>
## 1 1 my hubbie
## 2 1 hubbie and
## 3 1 and i
## 4 1 i walked
## 5 1 walked over
## 6 1 over after
## 7 1 after a
## 8 1 a long
## 9 1 long day
## 10 1 day of
## # ... with 2,994 more rows
bigrams_filtered=bigrams_separated %>%
filter(!word1 %in% stop_words$word) %>%
filter(!word2 %in% stop_words$word)
bigrams_filtered
## # A tibble: 366 x 3
## line word1 word2
## <int> <chr> <chr>
## 1 1 jalapeno business
## 2 1 attentive nice
## 3 1 bit expensive
## 4 2 food nice
## 5 2 nice tap
## 6 2 tap beer
## 7 2 beer selection
## 8 3 nasty rude
## 9 3 rude staff
## 10 3 recently accosted
## # ... with 356 more rows
bigram_counts<-bigrams_filtered %>%
count(word1,word2,sep=" ")
bigram_counts
## # A tibble: 340 x 4
## word1 word2 sep n
## <chr> <chr> <chr> <int>
## 1 12pm brunch 1
## 2 3 loved 1
## 3 30 min 1
## 4 4 stars 1
## 5 45 minutes 1
## 6 5 star 1
## 7 5 stars 2
## 8 7 8 1
## 9 absolutely wonderful 1
## 10 almonds greeted 1
## # ... with 330 more rows
bigrams_united<-bigrams_filtered %>%
unite(bigram,word1,word2,sep=" ")
bigrams_united
## # A tibble: 366 x 2
## line bigram
## * <int> <chr>
## 1 1 jalapeno business
## 2 1 attentive nice
## 3 1 bit expensive
## 4 2 food nice
## 5 2 nice tap
## 6 2 tap beer
## 7 2 beer selection
## 8 3 nasty rude
## 9 3 rude staff
## 10 3 recently accosted
## # ... with 356 more rows
Then to finish we created bigrams, which are two word strings, and took out stop words again to find phrases of real words that were most common.