Skip to content

Commit

Permalink
Closes 157 fix appendix for all (#162)
Browse files Browse the repository at this point in the history
* Align tags

* Update templates

* update appendix to all scripts

* update call to appendix functions

* run on branch

* add call to library

* add library call to template

* update wordlist

* added call to dplyr library

* added call to dplyr library

* update all appendices

* added filename

* fixed path

* workflow to main
  • Loading branch information
StefanThoma authored May 7, 2024
1 parent 2d87e4d commit ae602d6
Show file tree
Hide file tree
Showing 62 changed files with 670 additions and 431 deletions.
25 changes: 10 additions & 15 deletions R/appendix.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library(dplyr)
# markdown helpers --------------------------------------------------------

markdown_appendix <- function(name, content) {
Expand All @@ -15,15 +16,16 @@ insert_source <- function(repo_spec, name,
collection = "posts",
branch = "main",
host = "https://github.com",
text = "source code") {
text = "Source",
file_name) {
path <- paste(
host,
repo_spec,
"tree",
branch,
collection,
name,
"index.qmd",
file_name,
sep = "/"
)
return(markdown_link(text, path))
Expand All @@ -39,25 +41,17 @@ insert_lockfile <- function(repo_spec, name,
collection = "posts",
branch = "main",
host = "https://github.com",
text = "R environment") {
path <- paste(
host,
repo_spec,
"tree",
branch,
collection,
name,
"renv.lock",
sep = "/"
)
text = "Session info") {
path <- path <- "https://pharmaverse.github.io/blog/session_info.html"

return(markdown_link(text, path))
}



# top level function ------------------------------------------------------

insert_appendix <- function(repo_spec, name, collection = "posts") {
insert_appendix <- function(repo_spec, name, collection = "posts", file_name) {
appendices <- paste(
markdown_appendix(
name = "Last updated",
Expand All @@ -67,7 +61,8 @@ insert_appendix <- function(repo_spec, name, collection = "posts") {
markdown_appendix(
name = "Details",
content = paste(
insert_source(repo_spec, name, collection),
insert_source(repo_spec, name, collection, file_name = file_name),
# get renv information,
insert_lockfile(repo_spec, name, collection),
sep = ", "
)
Expand Down
2 changes: 2 additions & 0 deletions inst/WORDLIST.txt
Original file line number Diff line number Diff line change
Expand Up @@ -720,3 +720,5 @@ de
RightTool
Rlogo
sessioninfo
valuelevel
writeup
25 changes: 10 additions & 15 deletions inst/template/appendix.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library(dplyr)
# markdown helpers --------------------------------------------------------

markdown_appendix <- function(name, content) {
Expand All @@ -15,15 +16,16 @@ insert_source <- function(repo_spec, name,
collection = "posts",
branch = "main",
host = "https://github.com",
text = "source code") {
text = "Source",
file_name) {
path <- paste(
host,
repo_spec,
"tree",
branch,
collection,
name,
"code_sections.qmd",
file_name,
sep = "/"
)
return(markdown_link(text, path))
Expand All @@ -39,25 +41,17 @@ insert_lockfile <- function(repo_spec, name,
collection = "posts",
branch = "main",
host = "https://github.com",
text = "R environment") {
path <- paste(
host,
repo_spec,
"tree",
branch,
collection,
name,
"renv.lock",
sep = "/"
)
text = "Session info") {
path <- path <- "https://pharmaverse.github.io/blog/session_info.html"

return(markdown_link(text, path))
}



# top level function ------------------------------------------------------

insert_appendix <- function(repo_spec, name, collection = "posts") {
insert_appendix <- function(repo_spec, name, collection = "posts", file_name) {
appendices <- paste(
markdown_appendix(
name = "Last updated",
Expand All @@ -67,7 +61,8 @@ insert_appendix <- function(repo_spec, name, collection = "posts") {
markdown_appendix(
name = "Details",
content = paste(
insert_source(repo_spec, name, collection),
insert_source(repo_spec, name, collection, file_name = file_name),
# get renv information,
insert_lockfile(repo_spec, name, collection),
sep = ", "
)
Expand Down
4 changes: 3 additions & 1 deletion inst/template/template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ long_slug <- [SLUG]
source("appendix.R")
insert_appendix(
repo_spec = "pharmaverse/blog",
name = long_slug
name = long_slug,
# file_name should be the name of your file
file_name = list.files() %>% stringr::str_subset(".qmd") %>% first()
)
```
25 changes: 10 additions & 15 deletions posts/2023-06-27__hackathon_app/appendix.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library(dplyr)
# markdown helpers --------------------------------------------------------

markdown_appendix <- function(name, content) {
Expand All @@ -15,15 +16,16 @@ insert_source <- function(repo_spec, name,
collection = "posts",
branch = "main",
host = "https://github.com",
text = "source code") {
text = "Source",
file_name) {
path <- paste(
host,
repo_spec,
"tree",
branch,
collection,
name,
"index.qmd",
file_name,
sep = "/"
)
return(markdown_link(text, path))
Expand All @@ -39,25 +41,17 @@ insert_lockfile <- function(repo_spec, name,
collection = "posts",
branch = "main",
host = "https://github.com",
text = "R environment") {
path <- paste(
host,
repo_spec,
"tree",
branch,
collection,
name,
"renv.lock",
sep = "/"
)
text = "Session info") {
path <- path <- "https://pharmaverse.github.io/blog/session_info.html"

return(markdown_link(text, path))
}



# top level function ------------------------------------------------------

insert_appendix <- function(repo_spec, name, collection = "posts") {
insert_appendix <- function(repo_spec, name, collection = "posts", file_name) {
appendices <- paste(
markdown_appendix(
name = "Last updated",
Expand All @@ -67,7 +61,8 @@ insert_appendix <- function(repo_spec, name, collection = "posts") {
markdown_appendix(
name = "Details",
content = paste(
insert_source(repo_spec, name, collection),
insert_source(repo_spec, name, collection, file_name = file_name),
# get renv information,
insert_lockfile(repo_spec, name, collection),
sep = ", "
)
Expand Down
6 changes: 4 additions & 2 deletions posts/2023-06-27__hackathon_app/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ editor:
<!--------------- my typical setup ----------------->

```{r setup, include=FALSE}
long_slug <- "2023-06-19_shiny_run_script"
long_slug <- "2023-06-27__hackathon_app"
# renv::use(lockfile = "renv.lock")
```

Expand Down Expand Up @@ -385,6 +385,8 @@ From our perspective, the application provided a great added value to the hackat
source("appendix.R")
insert_appendix(
repo_spec = "pharmaverse/blog",
name = long_slug
name = long_slug,
# file_name should be the name of your file
file_name = list.files() %>% stringr::str_subset(".qmd") %>% first()
)
```
25 changes: 10 additions & 15 deletions posts/2023-06-27_admiral/valuelevel/appendix.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library(dplyr)
# markdown helpers --------------------------------------------------------

markdown_appendix <- function(name, content) {
Expand All @@ -15,15 +16,16 @@ insert_source <- function(repo_spec, name,
collection = "posts",
branch = "main",
host = "https://github.com",
text = "source code") {
text = "Source",
file_name) {
path <- paste(
host,
repo_spec,
"tree",
branch,
collection,
name,
"index.qmd",
file_name,
sep = "/"
)
return(markdown_link(text, path))
Expand All @@ -39,25 +41,17 @@ insert_lockfile <- function(repo_spec, name,
collection = "posts",
branch = "main",
host = "https://github.com",
text = "R environment") {
path <- paste(
host,
repo_spec,
"tree",
branch,
collection,
name,
"renv.lock",
sep = "/"
)
text = "Session info") {
path <- path <- "https://pharmaverse.github.io/blog/session_info.html"

return(markdown_link(text, path))
}



# top level function ------------------------------------------------------

insert_appendix <- function(repo_spec, name, collection = "posts") {
insert_appendix <- function(repo_spec, name, collection = "posts", file_name) {
appendices <- paste(
markdown_appendix(
name = "Last updated",
Expand All @@ -67,7 +61,8 @@ insert_appendix <- function(repo_spec, name, collection = "posts") {
markdown_appendix(
name = "Details",
content = paste(
insert_source(repo_spec, name, collection),
insert_source(repo_spec, name, collection, file_name = file_name),
# get renv information,
insert_lockfile(repo_spec, name, collection),
sep = ", "
)
Expand Down
6 changes: 4 additions & 2 deletions posts/2023-06-27_admiral/valuelevel/derive_param_computed.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ image: "derive_param_computed.jpg"
<!--------------- my typical setup ----------------->

```{r setup1, include=FALSE}
long_slug <- "admiral"
long_slug <- "2023-06-27_admiral"
# renv::use(lockfile = "renv.lock")
```

Expand Down Expand Up @@ -103,6 +103,8 @@ diffdf(adex_expected, adex_admiral, keys = c("USUBJID", "PARAMCD"))
source("appendix.R")
insert_appendix(
repo_spec = "pharmaverse/blog",
name = long_slug
name = paste0(long_slug, "/valuelevel"),
# file_name should be the name of your file
file_name = list.files() %>% stringr::str_subset(".qmd") %>% first()
)
```
25 changes: 10 additions & 15 deletions posts/2023-06-27_hackathon_writeup/appendix.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library(dplyr)
# markdown helpers --------------------------------------------------------

markdown_appendix <- function(name, content) {
Expand All @@ -15,15 +16,16 @@ insert_source <- function(repo_spec, name,
collection = "posts",
branch = "main",
host = "https://github.com",
text = "source code") {
text = "Source",
file_name) {
path <- paste(
host,
repo_spec,
"tree",
branch,
collection,
name,
"index.qmd",
file_name,
sep = "/"
)
return(markdown_link(text, path))
Expand All @@ -39,25 +41,17 @@ insert_lockfile <- function(repo_spec, name,
collection = "posts",
branch = "main",
host = "https://github.com",
text = "R environment") {
path <- paste(
host,
repo_spec,
"tree",
branch,
collection,
name,
"renv.lock",
sep = "/"
)
text = "Session info") {
path <- path <- "https://pharmaverse.github.io/blog/session_info.html"

return(markdown_link(text, path))
}



# top level function ------------------------------------------------------

insert_appendix <- function(repo_spec, name, collection = "posts") {
insert_appendix <- function(repo_spec, name, collection = "posts", file_name) {
appendices <- paste(
markdown_appendix(
name = "Last updated",
Expand All @@ -67,7 +61,8 @@ insert_appendix <- function(repo_spec, name, collection = "posts") {
markdown_appendix(
name = "Details",
content = paste(
insert_source(repo_spec, name, collection),
insert_source(repo_spec, name, collection, file_name = file_name),
# get renv information,
insert_lockfile(repo_spec, name, collection),
sep = ", "
)
Expand Down
6 changes: 4 additions & 2 deletions posts/2023-06-27_hackathon_writeup/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ image: "community.png"
<!--------------- my typical setup ----------------->

```{r setup, include=FALSE}
long_slug <- "2023-06-19_shiny_run_script"
long_slug <- "2023-06-27_hackathon_writeup"
# renv::use(lockfile = "renv.lock")
```

Expand Down Expand Up @@ -186,6 +186,8 @@ Please reach out to [Edoardo Mancini (product owner)](mailto:edoardo.mancini@roc
source("appendix.R")
insert_appendix(
repo_spec = "pharmaverse/blog",
name = long_slug
name = long_slug,
# file_name should be the name of your file
file_name = list.files() %>% stringr::str_subset(".qmd") %>% first()
)
```
Loading

0 comments on commit ae602d6

Please sign in to comment.