-
Notifications
You must be signed in to change notification settings - Fork 7
/
README.Rmd
125 lines (86 loc) · 3.17 KB
/
README.Rmd
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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
echo = FALSE,
message=FALSE,
warning=FALSE
)
```
# About
A personal website:
⚒️ created with the [distill](https://rstudio.github.io/distill/) package in R,
💡 continuously inspired by community contributed tips at the [distillery](https://jhelvy.github.io/distillery/) and all content creators out there,
🗨️ with commenting by [giscus](https://giscus.app/), and
🚀 deployed through Netlify.
```{r}
library(magrittr)
library(stringr)
library(dplyr)
library(xml2)
library(lubridate)
library(ggplot2)
```
```{r}
# inspired by Matt Dray's blog
# https://www.rostrum.blog/2021/04/14/gha-readme/
xml <- read_xml("https://www.pipinghotdata.com/blog.xml")
titles <- xml_find_all(xml, ".//title") %>%
str_remove_all("<title>|</title>") %>%
.[-1]
links <- xml_find_all(xml, ".//link") %>%
str_remove_all("<link>|</link>") %>%
.[-1]
dates <- links %>%
str_remove(".*posts/") %>%
str_sub(1, 10)
# extract text
# data frame of all posts
posts <- tibble(dates, titles, links)
# number of days since last post
days_last_post <- Sys.Date() - max(lubridate::as_date(dates))
posts_since_2020 <- posts %>%
mutate(dates = lubridate::as_date(dates)) %>%
filter(dates >= lubridate::as_date("2020-01-01"))
posts_per_month <- scales::number((nrow(posts_since_2020) / (as.numeric(today() - min(posts_since_2020$dates)))) * 30, 0.1)
days_bt_posts <- scales::number((as.numeric(today() - min(posts_since_2020$dates))) / nrow(posts), 1)
```
# Some stats ⚠️ WIP
🎉 Piping Hot Data has **`r nrow(posts)`** posts since **`r min(lubridate::as_date(dates))`**!
📅 That's a post roughly every **`r days_bt_posts`** days, or about `r posts_per_month` posts per month, since `r min(posts_since_2020$dates)`.
✍️ The last post was published **`r days_last_post`** days ago ([`r titles[1]`](`r links[1]`)). As Yihui Xie advises, I try to write like no one is reading. But your feedback does help motivate me to keep writing. 😉
```{r plot-obj, fig.height=1, fig.width=10}
# Create plot object
posts %>%
ggplot(aes(x = lubridate::as_date(dates), y = 1)) +
geom_point(shape = "|", size = 5, color = "#f95355") +
theme(
panel.grid = element_blank(),
# creates the light gray box around the plot ----
panel.background = element_rect(fill = "white", color = "white"),
axis.title = element_blank(),
axis.text.y = element_blank(),
axis.text.x = element_text(size = 14),
axis.ticks = element_blank(),
plot.margin = margin(0, 10, 0, 10)
) +
ggtitle("Published posts")
```
<details><summary>📂 Click to expand a full list of posts</summary>
```{r posts-table}
posts %>%
transmute(
Date = dates,
Title = paste0("[", titles, "](", links, ")")
) %>%
knitr::kable()
```
</details>
---
_The automatically rendered readme was inspired by [Matt Dray](https://www.rostrum.blog/2021/04/14/gha-readme/); giscus commenting
was motivated by [Joel Nitta](https://www.joelnitta.com/posts/2021-11-24_using-giscus/)._
_Updated `r Sys.time()`_