-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.qmd
160 lines (144 loc) · 5.43 KB
/
index.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
---
title: "Amit's Reading List"
subtitle: "A lifetime is not enough to read all the books I want to read!"
date: last-modified
author: "Amit Arora"
slug: index
theme: cosmo
---
```{r setup}
#| echo: false
#| warning: false
library(gt)
library(glue)
library(dplyr)
library(tidyr)
library(scales)
library(ggtext)
library(ggpmisc)
library(ggthemes)
library(gtExtras)
library(janitor)
library(tidyverse)
books <- read_csv("books.csv") %>%
janitor::clean_names()
books_read <- books %>%
filter(reading_status == "Finished")
genres <- unique(books$genre)
total <- nrow(books)
total_adjusted <- total - nrow(books %>% filter(reading_status == "On the bookshelf, but probably not gonna read" | reading_status == "Started but could not finish"))
finished <- nrow(books %>% filter(reading_status == "Finished"))
reading_backlog <- round((total_adjusted - finished)/total_adjusted, 2)
reading_backlog_status <- case_when(
reading_backlog < 0.3 ~ "a very healthy",
reading_backlog >= 0.3 & reading_backlog < 0.5 ~ "a reasonably ok",
TRUE ~ "an unhealthy"
)
# print(genres)
# print(unique(books$reading_status))
```
As a child I liked reading books but then over the years I lost the habit. Then a friend gifted me a book on my birthday and it helped me rediscover reading. There were two other factors that helped me get back to reading:
1. The Covid lockdowns of 2020 provided a little more time at hand. I could give time and energy to things I really wanted to do.
1. One good habit begets another, so as I started focussing more on physical fitness it had other positive side effects. I thought what else could I accomplish that I never thought possible, getting back to reading was a long standing desire.
To track the effectiveness of my reading habit, I define a metric that I like to call `reading backlog`. The `reading backlog` is defined as follows:
$$
\frac{number\:of\:books\:to\:read}{number\:of\:books\:excluding\:the\:ones\:I\:would\:probably\:never\:read}
$$
The lower the `reading backlog` value the better. As of `r Sys.Date()`, the `reading backlog` stands at _`r reading_backlog_status`_ value of `r reading_backlog`. The number of books on my bookshelf that I still plan to read is `r total_adjusted - finished`.
Here is a graphic showing what genres I like to read. Productiviy and health stand out.
```{r}
#| echo: false
#| warning: false
book_counts_by_genre <- books %>%
#filter(reading_status == "Finished") %>%
count(genre, sort=TRUE)
genre_w_most_books1 <- book_counts_by_genre$genre[1]
genre_w_most_books2 <- book_counts_by_genre$genre[2]
genre_w_most_books3 <- book_counts_by_genre$genre[3]
book_counts_by_genre %>%
ggplot(aes(x=reorder(genre, -n), y=n, col=genre, fill=genre)) +
geom_bar(stat="identity") +
scale_y_continuous(breaks = pretty_breaks()) +
coord_flip() +
scale_color_tableau(palette = "Tableau 20",) +
scale_fill_tableau(palette = "Tableau 20") +
labs(title="I like to read books across different genres",
subtitle = glue("<span style='color:#FF00FF'>**\"{genre_w_most_books1}\", \"{genre_w_most_books2}\" and \"{genre_w_most_books3}\"**</span> are the genres I like the most!")) +
theme_fivethirtyeight() +
theme(legend.position = "none", plot.subtitle = element_markdown()) +
theme(axis.title = element_text()) +
ylab('Number of books') +
xlab("")
```
```{r}
#| execute: false
#| echo: false
#| warning: false
p <- books %>%
filter(reading_status == "Finished") %>%
count(year_read_or_purchased, sort=TRUE) %>%
ggplot(aes(x=year_read_or_purchased, y=n)) +
geom_line(size=1) +
geom_point(size=2) +
scale_y_continuous(labels = comma) +
theme_fivethirtyeight() +
scale_color_tableau(palette="Tableau 20") +
scale_fill_tableau(palette="Tableau 20") +
labs(title="Books read per year") +
theme(legend.position="bottom") +
theme(text = element_text(size=15)) +
theme(axis.title = element_text()) +
ylab("Number of books read") + xlab("")
```
```{r}
#| echo: false
#| warning: false
books %>%
replace_na(list(notes = '-')) %>%
arrange(desc(year_read_or_purchased)) %>%
gt() %>%
gt_highlight_rows(rows=reading_status=="Currently Reading", font_weight = "normal") %>%
tab_style(
style = list(
cell_fill(color = "darkolivegreen1")
),
locations = cells_body(
rows = reading_status=="Finished")
) %>%
tab_style(
style = list(
cell_fill(color = "lightcyan")
),
locations = cells_body(
rows = reading_status=="Partially Read")
) %>%
cols_label(
book = "Book",
author = "Author",
genre = "Genre",
year_read_or_purchased = "Year",
reading_status="Reading Status",
notes="Notes"
) %>%
tab_header(title="Amit's book list",
subtitle=glue("{nrow(books)} books, {length(genres)} genres, {max(books$year_read_or_purchased, na.rm=TRUE)-min(books$year_read_or_purchased, na.rm=TRUE)} years")) %>%
tab_style(
locations = cells_column_labels(columns = everything()),
style = list(
#Give a thick border below
cell_borders(sides = "bottom", weight = px(3)),
#Make text bold
cell_text(weight = "bold")
)
) %>%
#Apply different style to the title
tab_style(
locations = cells_title(groups = "title"),
style = list(
cell_text(weight = "bold", size = 24)
)
)
```
:::{.callout-note}
This website was created using Quarto and GitHub actions, please see [/~https://github.com/aarora79/my-reading-list](/~https://github.com/aarora79/my-reading-list).
:::