# Importing data
df <- read_csv('./data/bestsellers with categories.csv')
## Rows: 550 Columns: 7
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): Name, Author, Genre
## dbl (4): 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.
# Removing duplicates
df <- df %>%
distinct(Name, .keep_all = TRUE) %>%
rename(User_Rating = 'User Rating')
# Importing second data
data <- read_csv('./data/charts.csv')
## Rows: 330087 Columns: 7
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): song, artist
## dbl (4): rank, last-week, peak-rank, weeks-on-board
## date (1): date
##
## ℹ 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.
data <- data %>%
rename(weeks_on_board = 'weeks-on-board',
peak_rank = 'peak-rank') %>%
select(-'last-week')
# Removing duplicates and select the max value
data1 <- data %>%
group_by(song, artist) %>%
summarise(weeks_on_board = max(weeks_on_board))
## `summarise()` has grouped output by 'song'. You can override using the
## `.groups` argument.
Books
Row 1
Column
Most Popular Authors
# Colors
custom_colors <- viridis::mako(n = 15)
# Most popular authors by reviews
df %>%
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_google()) %>%
hc_tooltip(pointFormat = '<b>Number of Reviews: </b> {point.y} <br>') %>%
hc_title(text = 'Most Popular Authors from 2009 to 2019',
style = list(fontSize = '25px', fontWeight = 'bold')) %>%
hc_subtitle(text = 'By Number of Reviews',
style = list(fontSize = '16px')) %>%
hc_credits(enabled = TRUE, text = '@miguelfzzz')
Most Popular Books
# Colors
custom_colors <- viridis::plasma(n = 15)
# Most popular books by reviews
df %>%
arrange(desc(Reviews)) %>%
head(15) %>%
hchart('bar', hcaes(x = Name, y = Reviews, color = custom_colors)) %>%
hc_add_theme(hc_theme_google()) %>%
hc_tooltip(pointFormat = '<b>Number of Reviews: </b> {point.y} <br>') %>%
hc_title(text = 'Most Popular Books from 2009 to 2019',
style = list(fontSize = '25px', fontWeight = 'bold')) %>%
hc_subtitle(text = 'By Number of Reviews',
style = list(fontSize = '16px')) %>%
hc_credits(enabled = TRUE, text = '@miguelfzzz')
Row
valueBox('YouTube Tutorial', icon = "fa-youtube", color="white")
YouTube Tutorial
valueBox('', icon = "fa-thumbs-up", color="white")
Row 2
Column
# Colors
custom_colors <- viridis::mako(n = 2)
# Most common genre
df %>%
group_by(Genre) %>%
summarise(count = n()) %>%
hchart('pie', hcaes(x = Genre, y = count, color = custom_colors)) %>%
hc_add_theme(hc_theme_google()) %>%
hc_tooltip(pointFormat='<b>Proportion: </b> {point.percentage:,.2f}%') %>%
hc_title(text = 'Most Common Genre from 2009 to 2019',
style = list(fontSize = '15px', fontWeight = 'bold')) %>%
hc_credits(enabled = TRUE, text = '@miguelfzzz')
# This is going to be a datatable
df1 <- df %>%
filter(User_Rating >= 4.9) %>%
arrange(desc(Reviews)) %>%
select(Name, Author)
# HTML table
div(style = 'height:600px; overflow-y:scroll', gt(df1) %>%
tab_header(title = md('Best Books from 2009 to 2019'),
subtitle = md('By Users Rating')) %>%
opt_table_font(font = list(google_font('Chivo'), default_fonts())) %>%
tab_style(location = 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))
)
| Best Books from 2009 to 2019 |
| By Users Rating |
| 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 |
Songs
## Row 1
## Row 2
Most Popular Songs on the Billboard “The Hot 100”
# Colors
custom_colors <- viridis::mako(n = 20)
# Most popular songs by weeks on board
data1 %>%
arrange(desc(weeks_on_board)) %>%
head(20) %>%
hchart('lollipop', hcaes(x = song, y = weeks_on_board, color = custom_colors)) %>%
hc_add_theme(hc_theme_google()) %>%
hc_tooltip(pointFormat = '<b>Number of Weeks on Board: </b> {point.y} <br>') %>%
hc_yAxis(title = list(text = 'Weeks on Board')) %>%
hc_xAxis(title = list(text = 'Songs')) %>%
hc_title(text = 'Most Popular Songs',
style = list(fontSize = '25px', fontWeight = 'bold')) %>%
hc_subtitle(text = 'By Number of Weeks on Board',
style = list(fontSize = '16px')) %>%
hc_credits(enabled = TRUE, text = '@miguelfzzz')
Most Popular Artists on the Billboard “The Hot 100”
# Colors
custom_colors <- viridis::plasma(n = 10)
# Most popular artists by weeks on board
data1 %>%
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_google()) %>%
hc_tooltip(pointFormat = '<b>Number of Weeks on Board: </b> {point.y} <br>') %>%
hc_title(text = 'Most Popular Artists',
style = list(fontSize = '25px', fontWeight = 'bold')) %>%
hc_subtitle(text = 'By Number of Weeks on Board',
style = list(fontSize = '16px')) %>%
hc_credits(enabled = TRUE, text = '@miguelfzzz')