Load Packages yang dubutuhkan
library(flexdashboard)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.3 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(highcharter)
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
library(gt)
## Warning: package 'gt' was built under R version 4.3.2
library(htmltools)
library(viridis)
## Loading required package: viridisLite
library(palmerpenguins)
library(widgetframe)
## Loading required package: htmlwidgets
Analisis Penjualan Buku terlaris Amazon 2009-2019
Tentang Kumpulan Data
Dataset Top 50 buku terlaris Amazon tahun 2009 hingga 2019. Berisi 550 buku, datanya dikategorikan menjadi fiksi dan nonfiksi menggunakan Goodreads
Selanjutnya kita mengimport dataset yang akan digunakan dan menampilkan 10 baris tabel pertama
book <- read_csv("book.csv")
## New names:
## Rows: 351 Columns: 8
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (3): Name, Author, Genre dbl (5): ...1, User_Rating, Reviews, Price, Year
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
head(book)
## # A tibble: 6 × 8
## ...1 Name Author User_Rating Reviews Price Year Genre
## <dbl> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <chr>
## 1 1 10-Day Green Smoothie Clea… JJ Sm… 4.7 17350 8 2016 Non …
## 2 2 11/22/63: A Novel Steph… 4.6 2052 22 2011 Fict…
## 3 3 12 Rules for Life: An Anti… Jorda… 4.7 18979 15 2018 Non …
## 4 4 1984 (Signet Classics) Georg… 4.7 21424 6 2017 Fict…
## 5 5 5,000 Awesome Facts (About… Natio… 4.8 7665 12 2019 Non …
## 6 6 A Dance with Dragons (A So… Georg… 4.4 12643 11 2011 Fict…
Kita akan mencari tahu Buku Terpopuler tahun 2009-2019 berdasarkan Review
# colors
custom_colors <- viridis::turbo(n = 17)
#most popular books by reviews
populer_book <- book %>%
arrange(desc(Reviews)) %>%
head(17) %>%
hchart('bar', hcaes(x = Name, y = Reviews, color = custom_colors)) %>%
hc_add_theme(hc_theme_flatdark()) %>%
hc_tooltip(pointFormat = '<b> Jumlah Ulasan : </b> {point.y} <br>') %>%
hc_title(text = 'Buku Terpopuler dari tahun 2009-2019',
style = list(fontSize = '25px', fontWeight = 'bold')) %>%
hc_subtitle(text = 'Berdasarkan Ulasan (Reviews)',
style =list(fontSize = '16px')) %>%
hc_credits(enabled = TRUE, text = '@deppalallo_harun')
frameWidget(populer_book)
Kita juga akan mencari tahu Penulis Terpopuler tahun 2009-2019 berdasarkan Review
# colors
custom_colors <- viridis::plasma(n = 15)
#most popular autors by reviews
populer_author <- book %>%
group_by(Author) %>%
summarise(Reviews=sum(Reviews)) %>%
arrange(desc(Reviews)) %>%
head(15) %>%
hchart('column', hcaes(x = Author, y = Reviews, color = custom_colors)) %>%
hc_add_theme(hc_theme_flatdark()) %>%
hc_tooltip(pointFormat = '<b> Jumlah Ulasan : </b> {point.y} <br>') %>%
hc_title(text = 'Penulis Terpopuler dari tahun 2009-2019',
style = list(fontSize = '25px', fontWeight = 'bold')) %>%
hc_subtitle(text = 'Berdasarkan Ulasan (Reviews)',
style = list(fontSize = '16px')) %>%
hc_credits(enabled = TRUE, text = '@deppalallo_harun')
frameWidget(populer_author)
## Warning in dir.create(target_dir): 'highchart_libs\highcharts' already exists
Kita juga akan melihat Kategori Terpopuler tahun 2009-2019 berdasarkan Review
#colors
custom_colors <- viridis::turbo(n=2)
#Most common gendre
populer_kategori <- book %>%
group_by(Genre) %>%
summarise(count = n()) %>%
hchart('pie', hcaes(x = Genre, y = count, color = custom_colors)) %>%
hc_add_theme(hc_theme_flatdark()) %>%
hc_tooltip(pointFormat = '<b> Proporsi : </b> {point.percentage:,.2f}%') %>%
hc_title(text = 'Genre Terpopuler dari Tahun 2009-2019',
style = list(fontSize = '15px', fontWeight = 'bold')) %>%
hc_credits(enabled = TRUE, text = '@deppalallo_harun')
frameWidget(populer_kategori)
Tabel Buku terpopuler berdasarkan ulasan pengguna
#Going to be a dta table
book1 <- book %>%
filter(User_Rating >= 4.9) %>%
arrange(desc(Reviews)) %>%
select(Name, Author)
#HTML table
div(style = 'height:600px; overflow-y:scroll', gt(book1) %>%
tab_header(title = md('Buku Terpopuler dari Tahun 2009-2019'),
subtitle = md('Berdasarkan Ulasan Pengguna')) %>%
opt_table_font(font = list(google_font('Chivo'), default_fonts())) %>%
tab_style(locations = cells_column_labels(columns = everything()),
style = list(cell_borders(sides = 'bottom', weight = px(2)),
cell_text(weight = 'bold'))) %>%
tab_options(table.font.size = px(12L),
table.border.top.style = 'none',
column_labels.border.bottom.width = 2,
table_body.border.top.style = 'none',
data_row.padding = px(3))
)
Buku Terpopuler dari Tahun 2009-2019 | |
Berdasarkan Ulasan Pengguna | |
Name | Author |
---|---|
Oh, the Places You'll Go! | Dr. Seuss |
Harry Potter and the Chamber of Secrets: The Illustrated Edition (Harry Potter, Book 2) | J.K. Rowling |
Jesus Calling: Enjoying Peace in His Presence (with Scripture References) | Sarah Young |
The Very Hungry Caterpillar | Eric Carle |
Brown Bear, Brown Bear, What Do You See? | Bill Martin Jr. |
Dog Man: Fetch-22: From the Creator of Captain Underpants (Dog Man #8) | Dav Pilkey |
Last Week Tonight with John Oliver Presents A Day in the Life of Marlon Bundo (Better Bundo Book, LGBT Childrens Book) | Jill Twiss |
Harry Potter and the Sorcerer's Stone: The Illustrated Edition (Harry Potter, Book 1) | J.K. Rowling |
Wrecking Ball (Diary of a Wimpy Kid Book 14) | Jeff Kinney |
Strange Planet (Strange Planet Series) | Nathan W. Pyle |
Dog Man: For Whom the Ball Rolls: From the Creator of Captain Underpants (Dog Man #7) | Dav Pilkey |
The Wonderful Things You Will Be | Emily Winfield Martin |
The Magnolia Story | Chip Gaines |
Harry Potter and the Goblet of Fire: The Illustrated Edition (Harry Potter, Book 4) (4) | J. K. Rowling |
Dog Man: Brawl of the Wild: From the Creator of Captain Underpants (Dog Man #6) | Dav Pilkey |
Rush Revere and the Brave Pilgrims: Time-Travel Adventures with Exceptional Americans (1) | Rush Limbaugh |
Goodnight, Goodnight Construction Site (Hardcover Books for Toddlers, Preschool Books for Kids) | Sherri Duskey Rinker |
Unfreedom of the Press | Mark R. Levin |
Hamilton: The Revolution | Lin-Manuel Miranda |
Dog Man: Lord of the Fleas: From the Creator of Captain Underpants (Dog Man #5) | Dav Pilkey |
The Legend of Zelda: Hyrule Historia | Patrick Thorpe |
Dog Man and Cat Kid: From the Creator of Captain Underpants (Dog Man #4) | Dav Pilkey |
Dog Man: A Tale of Two Kitties: From the Creator of Captain Underpants (Dog Man #3) | Dav Pilkey |
Rush Revere and the First Patriots: Time-Travel Adventures With Exceptional Americans (2) | Rush Limbaugh |
Obama: An Intimate Portrait | Pete Souza |
Harry Potter and the Prisoner of Azkaban: The Illustrated Edition (Harry Potter, Book 3) | J.K. Rowling |
Humans of New York : Stories | Brandon Stanton |
Little Blue Truck | Alice Schertle |
Analisis Lagu “The Hot 100” di Billboard
Tentang Kumpulan Data
Billboard Hot 100 adalah tangga rekaman standar industri musik di Amerika Serikat untuk lagu-lagu, yang diterbitkan mingguan oleh majalah Billboard. Pemeringkatan tangga lagu didasarkan pada penjualan, pemutaran radio, dan streaming online di Amerika Serikat.
Setiap minggu, Billboard merilis chart “The Hot 100” yang berisi lagu-lagu yang sedang tren dalam penjualan dan pemutaran pada minggu itu. Kumpulan data ini adalah kumpulan dari semua tangga lagu “The Hot 100” yang dirilis sejak dimulainya pada tahun 1958.
import dataset yang akan digunakan dan menampilkan 10 baris tabel pertama
song1 <- read_csv("song1.csv")
## New names:
## Rows: 29681 Columns: 4
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (2): song, artist dbl (2): ...1, weeks_on_board
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
head(song1)
## # A tibble: 6 × 4
## ...1 song artist weeks_on_board
## <dbl> <chr> <chr> <dbl>
## 1 1 "\"B\" Girls" Young And Rest… 15
## 2 2 "\"Cherry Cherry\" from Hot August Night" Neil Diamond 10
## 3 3 "\"Having A Party\" Medley" The Ovations (… 9
## 4 4 "\"Joy\" Pt. I" Isaac Hayes 9
## 5 5 "\"Roots\" Medley" Quincy Jones 7
## 6 6 "\"Yep!\"" Duane Eddy His… 9
Lagu Terpopuler di Billboard
#colors
custom_colors <- viridis::plasma(n =20)
# most popular author by weeks on board
populer_song <- song1 %>%
arrange(desc(weeks_on_board)) %>%
head(20) %>%
hchart('lollipop', hcaes(x = song, y = weeks_on_board, color = custom_colors)) %>%
hc_add_theme(hc_theme_flatdark()) %>%
hc_tooltip(pointFormat = '<b> Number of weeks on board : </b> {point.y} <br>') %>%
hc_yAxis(text = list('Weeks on Board')) %>%
hc_xAxis(text = list(text = 'Songs')) %>%
hc_title(text = 'Lagu Terpopuler',
style = list(fontSize = '25px', fontWeight = 'bold')) %>%
hc_subtitle(text = 'Berdasarkan (Weeks on Board)',
style = list(fontSize = '16px')) %>%
hc_credits(enabled = TRUE, text = '@deppalallo_harun')
frameWidget(populer_song)
## Warning in dir.create(target_dir): 'highchart_libs\highcharts' already exists
Artis Terpopuler di Billboard
#colors
custom_colors <- viridis::turbo(n=10)
#Most common gendre
populer_artists <- song1 %>%
group_by(artist) %>%
summarise(weeks_on_board=sum(weeks_on_board)) %>%
arrange(desc(weeks_on_board)) %>%
head(10) %>%
hchart('pie', hcaes(x = artist, y = weeks_on_board, color = custom_colors)) %>%
hc_add_theme(hc_theme_flatdark()) %>%
hc_tooltip(pointFormat = '<b> Number of weeks on board : </b> {point.y} <br>') %>%
hc_title(text = 'Artis Terpopuler',
style = list(fontSize = '25px', fontWeight = 'bold')) %>%
hc_subtitle(text = 'Berdasarkan Weeks on Board',
style = list(fontSize = '16px')) %>%
hc_credits(enabled = TRUE, text = '@deppalallo_harun')
frameWidget(populer_artists)