From 62705552c12b083fd257c25ac49d04e0acaa9bb3 Mon Sep 17 00:00:00 2001 From: Kate Isaac <41767733+kweav@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:49:21 -0500 Subject: [PATCH] example of writing chunks --- echo_chunks.R | 9 +++++++++ website_setup_test_chunks.Rmd | 15 +++++++++++++++ write_cheatsheets.R | 9 +++++++++ 3 files changed, 33 insertions(+) create mode 100644 echo_chunks.R create mode 100644 website_setup_test_chunks.Rmd create mode 100755 write_cheatsheets.R diff --git a/echo_chunks.R b/echo_chunks.R new file mode 100644 index 0000000..df27b74 --- /dev/null +++ b/echo_chunks.R @@ -0,0 +1,9 @@ +#!/usr/bin/env Rscript + +write_header <- function(cheatsheet_title, cheatsheet_subtitle){ + return(paste0('---\ntitle: |\n
', cheatsheet_title, '
\n

', cheatsheet_subtitle, '

\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 In the upper right, _click on_:
Use this template
\n\n Set your repo to **Public**')) +} diff --git a/website_setup_test_chunks.Rmd b/website_setup_test_chunks.Rmd new file mode 100644 index 0000000..4c6cfb4 --- /dev/null +++ b/website_setup_test_chunks.Rmd @@ -0,0 +1,15 @@ +--- +title: | +
OTTR Websites
+

Setup

+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) + + In the upper right, _click on_:
Use this template
+ + Set your repo to **Public** diff --git a/write_cheatsheets.R b/write_cheatsheets.R new file mode 100755 index 0000000..c97c8ea --- /dev/null +++ b/write_cheatsheets.R @@ -0,0 +1,9 @@ +#!/usr/bin/env Rscript + +library(here) +library(tidyverse) +source(here("echo_chunks.R")) + +c(write_header("OTTR Websites", "Setup"), + write_use_template("OTTR_Template_Website", "https://github.com/jhudsl/OTTR_Template_Website") + ) %>% write_lines(here("website_setup_test_chunks.Rmd"))