#Input Library dan Dataset
library(wordcloud)
## Loading required package: RColorBrewer
library(tm)
## Loading required package: NLP
library(textclean)
library(tidytext)
amazon_reviewsss <- read.csv("C:/Users/ASUS/Downloads/amazon_reviewsss.csv", sep=";", stringsAsFactors=TRUE)
head(amazon_reviewsss)
## reviewerID asin reviewerName helpful
## 1 A3SBTW3WS4IQSN B007WTAJTO [0, 0]
## 2 A18K1ODH1I2MVB B007WTAJTO 0mie [0, 0]
## 3 A2FII3I2MBMUIA B007WTAJTO 1K3 [0, 0]
## 4 A3H99DFEG68SR B007WTAJTO 1m2 [0, 0]
## 5 A375ZM4U047O79 B007WTAJTO 2&
## 6 A2IDCSC6NVONIZ B007WTAJTO 2Cents! [0, 0]
## reviewText
## 1 No issues.
## 2 Purchased this for my device, it worked as advertised. You can never have too much phone memory, since I download a lot of stuff this was a no brainer for me.
## 3 it works as expected. I should have sprung for the higher capacity. I think its made a bit cheesier than the earlier versions
## 4 This think has worked out great.Had a diff. bran 64gb card and if went south after 3 months.This one has held up pretty well since I had my S3, now on my Note3.*** update 3/21/14I've had this for a few months and have had ZERO issue's since it was transferred from my S3 to my Note3 and into a note2. This card is reliable and solid!Cheers!
## 5
## 6 It's mini storage. It doesn't do anything else and it's not supposed to. I purchased it to add additional storage to my Microsoft Surface Pro tablet which only come in 64 and 128 GB. It does what it's supposed to and SanDisk has a long standing reputation that speaks for itself.
## overall summary unixReviewTime reviewTime
## 1 4 Four Stars 1406073600 23/07/2014
## 2 5 MOAR SPACE!!! 1382659200 25/10/2013
## 3 NA NA
## 4 5 Great buy at this price!!! *** UPDATE 1384992000 21/11/2013
## 5 NA NA
## 6 5 Not a lot to really be said 1367193600 29/04/2013
## day_diff helpful_yes total_vote X X.1
## 1 138 0 0
## 2 409 0 0
## 3 NA NA NA
## 4 382 0 0
## 5 NA NA NA
## 6 588 0 0
#Mengubah Data Frame Menjadi Data Vektor
rev<- amazon_reviewsss$reviewText
head (rev)
## [1] No issues.
## [2] Purchased this for my device, it worked as advertised. You can never have too much phone memory, since I download a lot of stuff this was a no brainer for me.
## [3] it works as expected. I should have sprung for the higher capacity. I think its made a bit cheesier than the earlier versions
## [4] This think has worked out great.Had a diff. bran 64gb card and if went south after 3 months.This one has held up pretty well since I had my S3, now on my Note3.*** update 3/21/14I've had this for a few months and have had ZERO issue's since it was transferred from my S3 to my Note3 and into a note2. This card is reliable and solid!Cheers!
## [5]
## [6] It's mini storage. It doesn't do anything else and it's not supposed to. I purchased it to add additional storage to my Microsoft Surface Pro tablet which only come in 64 and 128 GB. It does what it's supposed to and SanDisk has a long standing reputation that speaks for itself.
## 4898 Levels: ...
##Text Cleaning
#Mengubah Kapital Menjadi Huruf Kecil
rev <- tolower(rev)
head(rev)
## [1] "no issues."
## [2] "purchased this for my device, it worked as advertised. you can never have too much phone memory, since i download a lot of stuff this was a no brainer for me."
## [3] "it works as expected. i should have sprung for the higher capacity. i think its made a bit cheesier than the earlier versions"
## [4] "this think has worked out great.had a diff. bran 64gb card and if went south after 3 months.this one has held up pretty well since i had my s3, now on my note3.*** update 3/21/14i've had this for a few months and have had zero issue's since it was transferred from my s3 to my note3 and into a note2. this card is reliable and solid!cheers!"
## [5] ""
## [6] "it's mini storage. it doesn't do anything else and it's not supposed to. i purchased it to add additional storage to my microsoft surface pro tablet which only come in 64 and 128 gb. it does what it's supposed to and sandisk has a long standing reputation that speaks for itself."
#Mengembalikan Kata yang disingkat Menjadi Kata Aslinya
rev <- replace_contraction(rev)
head(rev)
## [1] "no issues."
## [2] "purchased this for my device, it worked as advertised. you can never have too much phone memory, since i download a lot of stuff this was a no brainer for me."
## [3] "it works as expected. i should have sprung for the higher capacity. i think its made a bit cheesier than the earlier versions"
## [4] "this think has worked out great.had a diff. bran 64gb card and if went south after 3 months.this one has held up pretty well since i had my s3, now on my note3.*** update 3/21/14I have had this for a few months and have had zero issue's since it was transferred from my s3 to my note3 and into a note2. this card is reliable and solid!cheers!"
## [5] ""
## [6] "it is mini storage. it does not do anything else and it is not supposed to. i purchased it to add additional storage to my microsoft surface pro tablet which only come in 64 and 128 gb. it does what it is supposed to and sandisk has a long standing reputation that speaks for itself."
#Mengembalikan Kata yang Mengalami Perpanjangan Menjadi Kata Aslinya
rev <- replace_word_elongation(rev)
head(rev)
## [1] "no issues."
## [2] "purchased this for my device, it worked as advertised. you can never have too much phone memory, since i download a lot of stuff this was a no brainer for me."
## [3] "it works as expected. i should have sprung for the higher capacity. i think its made a bit cheesier than the earlier versions"
## [4] "this think has worked out great.had a diff. bran 64gb card and if went south after 3 months.this one has held up pretty well since i had my s3, now on my note3.*** update 3/21/14I have had this for a few months and have had zero issue's since it was transferred from my s3 to my note3 and into a note2. this card is reliable and solid!cheers!"
## [5] ""
## [6] "it is mini storage. it does not do anything else and it is not supposed to. i purchased it to add additional storage to my microsoft surface pro tablet which only come in 64 and 128 gb. it does what it is supposed to and sandisk has a long standing reputation that speaks for itself."
#Menghapus Huruf yang Bukan Kata
rev <- strip(rev)
head(rev)
## [1] "no issues"
## [2] "purchased this for my device it worked as advertised you can never have too much phone memory since i download a lot of stuff this was a no brainer for me"
## [3] "it works as expected i should have sprung for the higher capacity i think its made a bit cheesier than the earlier versions"
## [4] "this think has worked out greathad a diff bran gb card and if went south after monthsthis one has held up pretty well since i had my s now on my note update i have had this for a few months and have had zero issue's since it was transferred from my s to my note and into a note this card is reliable and solidcheers"
## [5] ""
## [6] "it is mini storage it does not do anything else and it is not supposed to i purchased it to add additional storage to my microsoft surface pro tablet which only come in and gb it does what it is supposed to and sandisk has a long standing reputation that speaks for itself"
#Menghapus Beberapa Kata
rev <-removeWords(rev, c("the","our","you","and","was","this","with","not","too","but","for",
"its","who","has","what","yet","your","out","else","more",
"own","are","abaut","just","because","all","etc","works","these","did","say","use","end","she","lot","can","not","for","saw","also","have","that","after",","))
head(rev)
## [1] "no issues"
## [2] "purchased my device it worked as advertised never much phone memory since i download a of stuff a no brainer me"
## [3] "it as expected i should sprung higher capacity i think made a bit cheesier than earlier versions"
## [4] " think worked greathad a diff bran gb card if went south monthsthis one held up pretty well since i had my s now on my note update i had a few months had zero issue's since it transferred from my s to my note into a note card is reliable solidcheers"
## [5] ""
## [6] "it is mini storage it does do anything it is supposed to i purchased it to add additional storage to my microsoft surface pro tablet which only come in gb it does it is supposed to sandisk a long standing reputation speaks itself"
##Membuat Word Cloud
#Mengubah Data Frame Menjadi Data Faktor
tdm <- TermDocumentMatrix(rev)
m <- as.matrix(tdm)
v <- sort(rowSums(m),decreasing = TRUE)
#Mengubah Data Faktor Menjadi Data Frame
d <- data.frame(word = names(v), freq = v)
wordcloud(d$word, d$freq,
random.order = FALSE,
max.words = 500,
colors = brewer.pal(name = "Dark2",8 ))
