Starbucks iOS App Analysis

Have you ever wanted to see more detail behind apps on your iOS device? There’s an R package called ‘itunesr’ that allows for free extracts of user ratings and reviews. Combining that with some sentiment analysis, you can examine any trends for apps of interest.

First, you’ll need to identify an app of interest. I use the
Starbucks
app quite a bit and have read numerous articles about it’s success. So, let’s see if ‘itunesr’ tells a similar story.

Let’s install the needed programs.

# Set CRAN Mirror
options(repos = c(CRAN = "http://cran.rstudio.com"))

# Set time zone
options(tz="America/New_York")

# install itunesr directly from CRAN:
install.packages("itunesr")
## Installing package into '/Users/kathryn_daugherty/Library/R/3.5/library'
## (as 'lib' is unspecified)
## 
## The downloaded binary packages are in
##  /var/folders/gb/t5w_mwv15mv1rqgt0c4n0m500000gn/T//RtmpdBqZ3E/downloaded_packages
# the development version from GitHub:
# install.packages("devtools")
# devtools::install_github("amrrs/itunesr")
library(itunesr)

Now, let’s find the app’s ID. To do this, you must search for it in the apple online store and you’ll find the number in the URL. Here is Starbucks’ page and you’ll note that its ID is 331177714.

# Starbucks page:  https://apps.apple.com/us/app/starbucks/id331177714
# Latest (Page 1) Starbucks Reviews for the Country: US
sbux_reviews <- getReviews(331177714,'us',1)
head(sbux_reviews,2)
##                                 Title
## 1                      Takes forever!
## 2 Beautifully designed and functional
##                                        Author_URL Author_Name App_Version
## 1 https://itunes.apple.com/us/reviews/id489505113   Revelaine        5.10
## 2 https://itunes.apple.com/us/reviews/id143796547      hbomb7        5.10
##   Rating
## 1      2
## 2      5
##                                                                                                                                                                                                                                                                                                                                                                                           Review
## 1 The new Starbucks store in Kearny NJ us ridiculously slow. When I use the app, it has taken up to 50 minutes to get my order.  One time, I waited and asked them to verify that they had received my order. They said they had, then 10 minutes later, said they had run out of the product. It’s a new store and perhaps they are working thru some kinks but they need to resolve this soon.
## 2                                                                        Love this app! It was beautifully designed (great UI/UX) and functions virtually flawlessly. Not a huge deal, but my only suggestion would be to be able to load an exiting gift card with another gift card’s balance, rather than having to create a new card, transfer the balance, then delete the card. Thank you.
##                  Date
## 1 2019-09-16 17:11:22
## 2 2019-09-16 16:34:37

This is a lot of data! Let’s start off by looking at the numerical ratings/scores that users have given the app.

# Ratings Trend
install.packages("highcharter")
## Installing package into '/Users/kathryn_daugherty/Library/R/3.5/library'
## (as 'lib' is unspecified)
## 
## The downloaded binary packages are in
##  /var/folders/gb/t5w_mwv15mv1rqgt0c4n0m500000gn/T//RtmpdBqZ3E/downloaded_packages
# install.packages("lubridate")
# install.packages("dplyr")
library(highcharter)
## Warning: package 'highcharter' was built under R version 3.5.2
## Highcharts (www.highcharts.com) is a Highsoft software product which is
## not free for commercial and Governmental use
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(lubridate)
## 
## Attaching package: 'lubridate'
## The following object is masked from 'package:base':
## 
##     date
dt <- sbux_reviews
dt$Date <- as.Date(dt$Date)
dt$Rating <- as.numeric(dt$Rating)    
dt <- dt %>% select(Date,Rating) %>% group_by(Date) %>% summarise(Rating = round(mean(Rating),2))
# Plot
highchart() %>%   hc_add_series_times_values(dt$Date,dt$Rating, name = 'Average Rating')

We see that the rating is generally pretty high. But, this doesn’t take advantage of all the text users have provided. To measure that, let’s use Bing’s defined sentiments to illustrate how positive/negative the feedback is.

# Sentiment Analysis 
install.packages("sentimentr")
## Installing package into '/Users/kathryn_daugherty/Library/R/3.5/library'
## (as 'lib' is unspecified)
## 
## The downloaded binary packages are in
##  /var/folders/gb/t5w_mwv15mv1rqgt0c4n0m500000gn/T//RtmpdBqZ3E/downloaded_packages
library(sentimentr)
## Warning: package 'sentimentr' was built under R version 3.5.2
library(tidytext)
library(stringr)
# identify and define sentiments/words
get_sentiments("bing")
## # A tibble: 6,788 x 2
##    word        sentiment
##    <chr>       <chr>    
##  1 2-faced     negative 
##  2 2-faces     negative 
##  3 a+          positive 
##  4 abnormal    negative 
##  5 abolish     negative 
##  6 abominable  negative 
##  7 abominably  negative 
##  8 abominate   negative 
##  9 abomination negative 
## 10 abort       negative 
## # ... with 6,778 more rows

Next, we’ll want to combine the sentiment scores with the words used in the reviews.

# pull in sbux info
reviews_only <- as.character(sbux_reviews$Review)
head(reviews_only,2)
## [1] "The new Starbucks store in Kearny NJ us ridiculously slow. When I use the app, it has taken up to 50 minutes to get my order.  One time, I waited and asked them to verify that they had received my order. They said they had, then 10 minutes later, said they had run out of the product. It’s a new store and perhaps they are working thru some kinks but they need to resolve this soon."
## [2] "Love this app! It was beautifully designed (great UI/UX) and functions virtually flawlessly. Not a huge deal, but my only suggestion would be to be able to load an existing gift card with another gift card’s balance, rather than having to create a new card, transfer the balance, then delete the card. Thank you."
sentiment_scores <- reviews_only %>% sentiment_by(by=NULL)
# plot findings
highchart() %>% hc_xAxis(sentiment_scores$element_id) %>% hc_add_series(sentiment_scores$ave_sentiment, name = 'Reviews Sentiment Scores')

Now we have two visualizations that give us information on our app of interest: Starbucks. This can easily be duplicated for any others… and it’s absolutely FREE.

[THE END]