-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
124 lines (94 loc) · 3.12 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-files/",
fig.retina = 3,
out.width = "100%"
)
```
<center>
![](assets/img/logo.png){width=50%}
</center>
# DrMowinckels website repo!
Welcome to the repository for my website.
This repository contains the code for my content.
```{r, echo = FALSE}
posts <- list.files("content/blog",
"^index.md",
recursive = TRUE,
full.names = TRUE)
posts <- lapply(posts, readLines)
find_key <- function(x, key){
j <- lapply(x, function(x){
k <- grep(sprintf("^%s:", key),
x, value = TRUE)
k <- gsub(sprintf("^%s: |'", key), "", k)
k[1]
})
unlist(j)
}
postdf <- data.frame(
n = seq_along(posts),
draft = find_key(posts, "draft") |>
grepl(pattern = "true", x = _),
date = as.Date(find_key(posts, "date")),
slug = find_key(posts, "slug") |>
gsub('\\"', "", x = _),
title = find_key(posts, "title")
) |>
subset(subset = !draft)
postdf$link <- sprintf("[%s](https://drmowinckels.io/blog/%s)",
postdf$title,
postdf$slug)
today <- Sys.Date()
min_date <- min(postdf$date)
last_post <- as.numeric(max(postdf$date) - today)
postavg <- nrow(postdf)/as.numeric(today - min_date) * 30
postavg <- sprintf("%0.2f", postavg)
postbtw <- as.numeric(today - min_date) / nrow(postdf)
postbtw <- sprintf("%s", round(postbtw, digits = 0))
```
## Some stats
🎉 DrMowinckels has **`r nrow(postdf)`** posts since **`r min_date`**!
📅 That's a post roughly every **`r postbtw`** days, or about **`r postavg`** posts per month, since `r min_date`.
✍️ The last post was published **`r last_post`** days ago (`r tail(postdf, 1)$link`).
😉 I'll post as often as I am able, and hope people find it interesting. I'd love your feedback in the comments!
```{r 'plot', echo = FALSE, fig.width=10, fig.height=2.5}
library(lattice)
postdf$ones <- 1
# Assuming postdf is loaded and has a 'date' column
xyplot(ones ~ date, data = postdf,
type = 'p',
pch = "|",
cex = 5,
col = "cyan3",
xlab = "",
ylab = "",
main = "Published posts",
scales = list(x = list(cex = 1.4), y = list(draw = FALSE)),
strip = FALSE, # Removes strip labels
axis.line = list(col = "transparent"),
layout = c(1, 1), # Single panel
par.settings = list(
strip.border = list(col = "transparent"), #making the border transparent
axis.line = list(col = "transparent") #making the axes transparent
)
)
```
<details><summary>📂 Click to expand a full list of posts</summary>
```{r posts-table, results='asis', echo = FALSE}
data.frame(
Date = rev(postdf$date),
Title = rev(postdf$link)
) |>
knitr::kable()
```
</details>
---
_The automatically rendered readme was inspired by [Matt Dray](https://www.rostrum.blog/2021/04/14/gha-readme/) and [Piping Hot Data](https://github.com/shannonpileggi/pipinghotdata_distill/blob/master/README.Rmd)._
_Updated `r Sys.time()`_