Update welcome, intro, and contributors

This commit is contained in:
Hadley Wickham
2022-11-04 12:45:16 -05:00
parent 5e080711ba
commit 3f68594404
4 changed files with 218 additions and 305 deletions

View File

@@ -274,31 +274,68 @@ This book was written in the open, and many people contributed pull requests to
Special thanks goes to everyone who contributed via GitHub:
```{r}
#| results: "asis"
#| eval: false
#| echo: false
library(tidyverse)
contribs_all_json <- gh::gh("/repos/:owner/:repo/contributors",
owner = "hadley",
repo = "r4ds",
.limit = Inf
)
contribs_all <- tibble(
login = contribs_all_json %>% map_chr("login"),
n = contribs_all_json %>% map_int("contributions")
)
contribs_old <- read_csv("contributors.csv", col_types = list())
contribs_new <- contribs_all %>% anti_join(contribs_old, by = "login")
# Get info for new contributors
needed_json <- map(
contribs_new$login,
~ gh::gh("/users/:username", username = .x),
.progress = TRUE
)
info_new <- tibble(
login = contribs_new$login,
name = map_chr(needed_json, "name", .default = NA),
blog = map_chr(needed_json, "blog", .default = NA)
)
info_old <- contribs_old %>% select(login, name, blog)
info_all <- bind_rows(info_old, info_new)
contribs_all <- contribs_all %>%
left_join(info_all, by = "login") %>%
arrange(login)
write_csv(contribs_all, "contributors.csv")
```
```{r}
#| results: asis
#| echo: false
#| message: false
library(dplyr)
# git --no-pager shortlog -ns > contribs.txt
contribs <- readr::read_tsv("contribs.txt", col_names = c("n", "name"))
contributors <- readr::read_csv("contributors.csv")
contributors <- contributors %>%
filter(!login %in% c("hadley", "garrettgman", "mine-cetinkaya-rundel")) %>%
mutate(
login = paste0("\\@", login),
desc = ifelse(is.na(name), login, paste0(name, " (", login, ")"))
)
contribs <- contribs |>
filter(!name %in% c("hadley", "Garrett", "Hadley Wickham",
"Garrett Grolemund", "Mine Cetinkaya-Rundel")) |>
arrange(name) |>
mutate(uname = ifelse(!grepl(" ", name), paste0("\\@", name), name))
cat("Thanks go to all contributers in alphabetical order: ")
cat(paste0(contribs$uname, collapse = ", "))
cat("A big thank you to all ", nrow(contributors), " people who contributed specific improvements via GitHub pull requests (in alphabetical order by username): ", sep = "")
cat(paste0(contributors$desc, collapse = ", "))
cat(".\n")
```
## Colophon
An online version of this book is available at [https://r4ds.had.co.nz](https://r4ds.hadley.nz){.uri}.
An online version of this book is available at <https://r4ds.hadley.nz>.
It will continue to evolve in between reprints of the physical book.
The source of the book is available at <https://github.com/hadley/r4ds>.
The book is powered by <https://bookdown.org> which makes it easy to turn R Markdown files into HTML, PDF, and EPUB.
The book is powered by [Quarto](https://quarto.org) which makes it easy to write books that combine text and executable code.
This book was built with: