Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example of writing chunks using functions #7

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ navbar:
icon: fa-home
- text: Website Setup
href: website_setup.html
- text: Course Setup
href: course_setup.html


output:
Expand Down
15 changes: 15 additions & 0 deletions course_setup.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: |
<center> <u>OTTR Courses</u></center>
<center> <p style = "color:#986753;">Setup</p></center>
date: "Last updated: `r format(Sys.time(), '%B %d, %Y')`"
output: html_document
css: style.css
---


## Create your OTTR repository from the [OTTR_Template repository](https://github.com/jhudsl/OTTR_Template)

<input type="checkbox"> In the upper right, _click on_: <div class = "github_button"><a href="https://github.com/new?template_name=OTTR_Template&template_owner=jhudsl"> Use this template</a></div>

<input type="checkbox"> Set your repo to **Public**
9 changes: 9 additions & 0 deletions echo_chunks.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env Rscript

write_header <- function(cheatsheet_title, cheatsheet_subtitle){
return(paste0('---\ntitle: |\n <center> <u>', cheatsheet_title, '</u></center>\n <center> <p style = "color:#986753;">', cheatsheet_subtitle, '</p></center>\ndate: "Last updated: `r format(Sys.time(), \'%B %d, %Y\')`"\noutput: html_document\ncss: style.css\n---'))
}

write_use_template <- function(template_name, template_url){
return(paste0('\n\n## Create your OTTR repository from the [', template_name, ' repository](', template_url, ')\n\n<input type="checkbox"> In the upper right, _click on_: <div class = "github_button"><a href="https://github.com/new?template_name=', template_name, '&template_owner=jhudsl"> Use this template</a></div>\n\n<input type="checkbox"> Set your repo to **Public**'))
}
15 changes: 15 additions & 0 deletions website_setup_test_chunks.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: |
<center> <u>OTTR Websites</u></center>
<center> <p style = "color:#986753;">Setup</p></center>
date: "Last updated: `r format(Sys.time(), '%B %d, %Y')`"
output: html_document
css: style.css
---


## Create your OTTR repository from the [OTTR_Template_Website repository](https://github.com/jhudsl/OTTR_Template_Website)

<input type="checkbox"> In the upper right, _click on_: <div class = "github_button"><a href="https://github.com/new?template_name=OTTR_Template_Website&template_owner=jhudsl"> Use this template</a></div>

<input type="checkbox"> Set your repo to **Public**
9 changes: 9 additions & 0 deletions write_cheatsheets.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env Rscript

library(here)
library(tidyverse)
source(here("echo_chunks.R"))

c(write_header("OTTR Courses", "Setup"),
write_use_template("OTTR_Template", "https://github.com/jhudsl/OTTR_Template")
) %>% write_lines(here("course_setup.Rmd"))
Loading