This case study aims to find the five books that received the highest
number of explicit ratings in the Book-Crossing dataset. The analysis
was performed using the Ratings.csv file and R programming.
The dataset was first examined to understand its structure, size and
rating distribution. Records with a rating value of zero were excluded
because the objective was to study explicit ratings. The remaining
records were grouped using ISBN to calculate the number of ratings
received by each book. The counts were then arranged in descending order
to identify the top five books. The results were presented using a
horizontal bar chart created with the ggplot2 package. The
analysis found that ISBN 0316666343 had the highest number
of explicit ratings, with 707 ratings. The study demonstrates how R can
be used to filter, summarize and visualize data to identify books that
have received considerable attention from readers.
Online shopping has changed the way customers choose and purchase products. In an online bookstore, customers may have access to a large number of books, making it difficult to decide which books to explore. Customer ratings can provide useful information about the level of interaction customers have with different books.
A book that has received a large number of ratings has attracted feedback from many users in the dataset. Although the number of ratings does not necessarily indicate the quality of a book or its sales, it can provide an indication of customer engagement.
In this case study, the Book-Crossing ratings dataset is used to identify the five books with the highest number of explicit ratings. The analysis is carried out using R programming. The dataset is inspected, filtered and summarized, and the results are presented through a bar chart. The analysis is intended to provide a simple way of identifying books that have received comparatively greater attention from users.
A book shop wants to recommend books with many explicit ratings. The available ratings dataset contains records of users rating different books. However, identifying the books that have received the most explicit ratings requires the data to be processed and summarized.
The objective of this case study is to use the
Ratings.csv file, remove records with rating values of
zero, calculate the number of explicit ratings received by each ISBN and
identify the five ISBNs with the highest counts. The results will be
presented using a bar chart.
The objectives of this case study are:
The dataset used in this case study is the Book-Crossing Dataset, obtained from Kaggle.
Dataset source: Book Recommendation Dataset
Link: https://www.kaggle.com/datasets/arashnic/book-recommendation-dataset
The dataset contains information related to books, users and ratings.
For this case study, only the Ratings.csv file is used, as
the analysis is limited to the number of explicit ratings received by
each book.
The Ratings.csv file contains 1,149,780 records and
three columns. Each record represents a rating associated with a user
and a book.
The dataset was imported and examined using R functions such as
head(), str(), summary() and
dim().
| Attribute | Data Type | Description |
|---|---|---|
| User-ID | Integer | Identifies the user who provided the rating |
| ISBN | Character | Identifies the book |
| Book-Rating | Integer | Represents the rating given to the book |
The ISBN is stored as a character variable because it is an identifier and should not be treated as a numerical value. The rating column contains values ranging from zero to ten in the dataset.
This analysis is limited to the records available in
Ratings.csv. The other files in the Book-Crossing dataset
are not used. The analysis focuses on rating frequency and does not
examine book titles, authors, sales figures or user demographics.
The analysis was performed in R using the dplyr and
ggplot2 packages.
The following steps were carried out:
The read.csv() function was used to import the dataset.
The functions head(), str(),
summary() and dim() were used during the
initial inspection. Missing values were checked using
colSums(is.na()), and table() was used to
examine the distribution of ratings.
The filter() function was used to retain explicit
ratings. The count() function was used to calculate the
rating count for each ISBN. The results were sorted using
arrange() and desc(), and the top five records
were selected using slice_head().
Finally, ggplot2 was used to create a horizontal bar
chart.
The dataset was imported into R using the following code.
library(dplyr)
library(ggplot2)
ratings <- read.csv(
"Ratings.csv",
stringsAsFactors = FALSE,
check.names = FALSE
)
The first six records were displayed to get an initial understanding of the dataset.
head(ratings)
## User-ID ISBN Book-Rating
## 1 276725 034545104X 0
## 2 276726 0155061224 5
## 3 276727 0446520802 0
## 4 276729 052165615X 3
## 5 276729 0521795028 6
## 6 276733 2080674722 0
The structure of the dataset was examined using
str().
str(ratings)
## 'data.frame': 1149780 obs. of 3 variables:
## $ User-ID : int 276725 276726 276727 276729 276729 276733 276736 276737 276744 276745 ...
## $ ISBN : chr "034545104X" "0155061224" "0446520802" "052165615X" ...
## $ Book-Rating: int 0 5 0 3 6 0 8 6 7 10 ...
The summary of the dataset was obtained using
summary().
summary(ratings)
## User-ID ISBN Book-Rating
## Min. : 2 Length :1149780 Min. : 0.000
## 1st Qu.: 70345 N.unique : 340556 1st Qu.: 0.000
## Median :141010 N.blank : 0 Median : 0.000
## Mean :140386 Min.nchar: 8 Mean : 2.867
## 3rd Qu.:211028 Max.nchar: 14 3rd Qu.: 7.000
## Max. :278854 Max. :10.000
The dimensions of the dataset were checked using
dim().
dim(ratings)
## [1] 1149780 3
The dataset contains 1,149,780 records and three columns. The columns are User-ID, ISBN and Book-Rating. User-ID and Book-Rating are integer variables, while ISBN is a character variable.
These initial checks helped in understanding the data before carrying out the filtering and counting operations.
Missing values were checked using the following command.
colSums(is.na(ratings))
## User-ID ISBN Book-Rating
## 0 0 0
The result showed that there were no missing values in the User-ID, ISBN or Book-Rating columns. Therefore, the dataset did not require the removal of records due to missing values in these columns.
The rating distribution was examined using the table()
function.
table(ratings$`Book-Rating`)
##
## 0 1 2 3 4 5 6 7 8 9 10
## 716109 1770 2759 5996 8904 50974 36924 76457 103736 67541 78610
The output shows the number of records associated with each rating value. The dataset contains zero ratings as well as explicit ratings ranging from one to ten.
In the Book-Crossing dataset, a rating of zero represents an implicit rating, whereas values from one to ten represent explicit ratings. Since the objective is to identify books with many explicit ratings, records containing zero ratings are not considered in the subsequent analysis.
The dataset was filtered to retain only records where the Book-Rating value was greater than zero.
explicit_ratings <- ratings %>%
filter(`Book-Rating` > 0)
The dimensions of the filtered dataset were checked.
dim(explicit_ratings)
## [1] 433671 3
The first six records of the filtered dataset were also displayed.
head(explicit_ratings)
## User-ID ISBN Book-Rating
## 1 276726 0155061224 5
## 2 276729 052165615X 3
## 3 276729 0521795028 6
## 4 276736 3257224281 8
## 5 276737 0600570967 6
## 6 276744 038550120X 7
After filtering, 433,671 records remained. These records contain explicit ratings, with rating values greater than zero.
This step was necessary because the case study focuses on books that received explicit ratings.
The filtered records were grouped by ISBN to calculate the number of explicit ratings received by each book.
rating_counts <- explicit_ratings %>%
count(ISBN, name = "Rating_Count")
The first few records of the aggregated table were displayed.
head(rating_counts)
## ISBN Rating_Count
## 1 0330299891 1
## 2 0375404120 1
## 3 9022906116 1
## 4 #6612432 1
## 5 '9607092910' 1
## 6 )416195113 1
The resulting table contains each ISBN and the number of explicit ratings associated with it.
The counts were then sorted in descending order.
sorted_books <- rating_counts %>%
arrange(desc(Rating_Count))
Sorting the records makes it possible to identify the books with the highest number of explicit ratings.
The first five records from the sorted table were selected.
top_5_books <- sorted_books %>%
slice_head(n = 5)
print(top_5_books)
## ISBN Rating_Count
## 1 0316666343 707
## 2 0971880107 581
## 3 0385504209 487
## 4 0312195516 383
## 5 0679781587 333
The results obtained are presented below.
| ISBN | Rating Count |
|---|---|
| 0316666343 | 707 |
| 0971880107 | 581 |
| 0385504209 | 487 |
| 0312195516 | 383 |
| 0679781587 | 333 |
The ISBN 0316666343 received the highest number of
explicit ratings, with 707 records. It was followed by
0971880107, which received 581 ratings.
The remaining ISBNs in the top five were 0385504209,
0312195516 and 0679781587.
These results represent the number of explicit rating records associated with each ISBN and are not based on sales figures or average rating scores.
A horizontal bar chart was created to compare the number of explicit ratings received by the five selected ISBNs.
book_chart <- ggplot(
top_5_books,
aes(
x = reorder(ISBN, Rating_Count),
y = Rating_Count
)
) +
geom_col(fill = "#8F7AAE") +
coord_flip() +
labs(
title = "Top 5 Books by Explicit Rating Count",
subtitle = "Book-Crossing Dataset",
x = "ISBN",
y = "Number of Explicit Ratings"
) +
theme_minimal()
print(book_chart)
The horizontal bar chart displays the rating count for each of the five ISBNs. The ISBN with the highest count is positioned at the top of the chart, making the comparison easier to understand.
ISBN 0316666343 has the longest bar, representing 707
explicit ratings. ISBN 0971880107 follows with 581 ratings.
The remaining books have progressively lower rating counts.
A horizontal bar chart was chosen because it allows the ISBN labels and rating counts to be compared clearly.
| Chart | Type | Purpose | Observation |
|---|---|---|---|
| Top 5 Books by Explicit Rating Count | Horizontal bar chart | Compares rating counts for the five ISBNs | ISBN 0316666343 has the highest count of 707 |
The chart helps summarize the results of the analysis in a visual format rather than relying only on a table.
The analysis produced the following findings:
0316666343 had the highest number of explicit
ratings, with 707.0971880107 ranked second, with 581 ratings.The results show that the number of explicit ratings varies among the ISBNs in the dataset. The first two ISBNs have higher rating counts than the remaining three books in the selected group.
Based on the results of the analysis, the following suggestions may be considered by an online bookstore.
Improving book visibility: Books with higher rating counts may be considered for featured sections or recommendation displays.
Promotional activities: The identified ISBNs could be considered when planning promotional campaigns, subject to additional business information.
Customer engagement: Rating counts may help the bookstore identify books that have received comparatively greater attention from customers.
Combining additional information: Rating counts could be considered alongside sales data, average ratings and book information to make more informed business decisions.
These recommendations are based only on rating counts. A higher number of ratings does not necessarily mean that a book has higher sales, better quality or greater profitability.
This case study was carried out to identify the five books with the
highest number of explicit ratings in the Book-Crossing dataset. The
analysis used only the Ratings.csv file and was performed
using R programming.
The dataset was inspected, missing values were checked and the rating distribution was examined. Records with a rating value of zero were excluded. The remaining records were grouped by ISBN to calculate the number of explicit ratings received by each book. The results were then sorted, and the five ISBNs with the highest rating counts were selected.
The analysis identified ISBN 0316666343 as the book with
the highest number of explicit ratings, with 707 records. ISBN
0971880107 ranked second with 581 records.
The results were presented using a horizontal bar chart created with
ggplot2. This chart made it easier to compare the rating
counts of the five selected ISBNs.
Through this case study, data inspection, filtering, aggregation, sorting and visualization were performed using R. The results provide a simple view of the books that received the highest number of explicit ratings in the dataset.
The analysis can be extended in the following ways:
These are possible extensions of the case study and were not part of the analysis performed.
Book-Crossing Dataset. Book Recommendation Dataset, Kaggle.
https://www.kaggle.com/datasets/arashnic/book-recommendation-dataset
R Core Team. R: A Language and Environment for Statistical
Computing.
https://www.r-project.org/
ggplot2 Documentation.
https://ggplot2.tidyverse.org/
dplyr Documentation.
https://dplyr.tidyverse.org/