Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cansavvy committed Apr 8, 2021
0 parents commit e0a5a76
Show file tree
Hide file tree
Showing 61 changed files with 3,745 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/style-and-sp-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

# This code was originally written by Josh Shapiro and Candace Savonen
# for the Childhood Cancer Data Lab, an initiative of Alexs Lemonade Stand Foundation.
# https://github.com/AlexsLemonade/refinebio-examples/blob/33cdeff66d57f9fe8ee4fcb5156aea4ac2dce07f/.github/workflows/style-and-sp-check.yml#L1

# Adapted for this jhudsl repository by Candace Savonen Apr 2021

name: Style and spell check R markdowns

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
pull_request:
branches: [ main ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "style and check"
style-n-check:
runs-on: ubuntu-latest
container:
image: rocker/tidyverse:4.0.2

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
# What branch to commit to: the one from the pull request
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Install packages
run: Rscript -e "install.packages(c('styler', 'spelling'))"

- name: Run spell check
id: spell_check_run
run: |
results=$(Rscript "scripts/spell-check.R")
echo "::set-output name=sp_chk_results::$results"
cat spell_check_results.tsv
- name: Archive spelling errors
uses: actions/upload-artifact@v2
with:
name: spell-check-results
path: spell_check_results.tsv

# If there are too many spelling errors, this will stop the workflow
- name: Check spell check results - fail if too many errors
if: ${{ steps.spell_check_run.outputs.sp_chk_results > 3 }}
run: exit 1

- name: Run styler
run: Rscript -e "styler::style_file(list.files(pattern = 'Rmd$', recursive = TRUE, full.names = TRUE));warnings()"

- name: Commit
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add \*.Rmd
git commit -m 'Style Rmds' || echo "No changes to commit"
git push origin || echo "No changes to commit"
35 changes: 35 additions & 0 deletions .github/workflows/url-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Adapted from https://github.com/marketplace/actions/url-checker by Candace Savonen

# This github actions tests URLs in the Rmd files, README, and CONTRIBUTING.md
name: Check URLs

# This will be run upon PRs to main
on:
pull_request:
branches: [ main ]

# Here's the main action of checking URLs
jobs:
check_urls:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
# What branch to commit to: the one from the pull request
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Get Rmd file names
id: get_rmds
run: |
rmd_files=$(find . -type f -name '*.Rmd' -exec basename {} \;)
rmd_files=$(echo "$rmd_files" | xargs | sed -e 's/ /,/g')
file_list="CONTRIBUTING.md,README.md,${rmd_files[@]}"
echo "::set-output name=all_files::$file_list"
echo $file_list
- name: Check URLs
uses: paramt/url-checker@master
with:
files: "${{ steps.get_rmds.outputs.all_files }}"
blacklist: "${{ steps.get_rmds.outputs.all_files }},01-intro.md,about.md"
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

# ignore nonsense files
.DS_Store
.Rhistory
.local
.rstudio
.bash_history

spell_check_results.tsv


15 changes: 15 additions & 0 deletions 01-intro.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: "Course Title"
output: html_document
---

# Introduction

## Motivation
This course will cover

**Target Audience:**
The course is intended for

**Curriculum:**
The curriculum will cover
72 changes: 72 additions & 0 deletions 02-chapter_of_course.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
title: "Chapter title"
output: html_document
---

## Learning Objectives

This chapter will cover:

- {You can use https://www.bu.edu/cme/forms/RSS_forms/tips_for_writing_objectives.pdf to define some learning objectives here}
- {Another learning objective}

## Libraries

For this chapter, we'll need the following packages attached.

```{r}
library(here)
library(ggplot2)
library(magrittr)
```

# Topic of Section

Text Text

## Subtopic

Text Text

### Code examples

```{r}
output_dir <- "code_output"
if (!dir.exists(output_dir)) {
dir.create(output_dir)
}
```

```{r}
iris %>%
ggplot(aes(Sepal.Length, Sepal.Width, color = Species)) +
geom_point() +
theme_bw()
```

```{r}
ggsave(file.path(output_dir, "test_ggplot2.png"))
```

### Image examples

![](resources/images/itcr_training_network.png)

![](resources/images/tools.png)

### Video example

![Introducing Markua](https://www.youtube.com/watch?t=105&v=VOCYL-FNbr0)

### Citation examples

We can put citations at the end of a sentence like this [@bookdown2016].

In text, we can put citations like this @bookdown2016.

## Print out session info

```{r}
devtools::session_info()
```

10 changes: 10 additions & 0 deletions About.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "about"
output: html_document
---

# About the Authors {-}


**Author Name** is a Blank in the Blank at the Blank.

Loading

0 comments on commit e0a5a76

Please sign in to comment.