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

WIP: add skeleton notes to workflow #60

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
cfdbb78
add skeleton-notes workflow
BonnieJRobert Jan 13, 2023
d8921fd
temporarily disable steps
BonnieJRobert Jan 13, 2023
dcf9177
minor changes to test step
BonnieJRobert Jan 13, 2023
c364cbe
minor changes to test step
BonnieJRobert Jan 13, 2023
1117069
minor changes to test step
BonnieJRobert Jan 13, 2023
ba8d314
add test file
Jan 13, 2023
5a8e45a
test workflow-run again
BonnieJRobert Jan 13, 2023
cec9a95
temporarily disable more steps
BonnieJRobert Jan 13, 2023
55a791b
add test file
Jan 13, 2023
70e7393
test shell script
BonnieJRobert Jan 13, 2023
d213876
folder name
BonnieJRobert Jan 13, 2023
7954d4c
add helloworld.Rmd
BonnieJRobert Jan 13, 2023
cf92161
add helloworld.Rmd
BonnieJRobert Jan 13, 2023
5956a8b
remove bookdown workflow for this branch
BonnieJRobert Jan 13, 2023
49c9f15
minor edits
BonnieJRobert Jan 13, 2023
1382ef8
add test file
Jan 13, 2023
409e13a
loop through .Rmds
BonnieJRobert Jan 13, 2023
b5e97d8
test sed
BonnieJRobert Jan 13, 2023
3bf0961
minor edit
BonnieJRobert Jan 13, 2023
c3b2751
add helloworld file
Jan 13, 2023
6526773
all sed commands
BonnieJRobert Jan 13, 2023
6985346
add helloworld file
Jan 13, 2023
3f910fd
remove tmp files
BonnieJRobert Jan 13, 2023
e5b20ed
create output files
BonnieJRobert Jan 13, 2023
b46ee65
minor edit
BonnieJRobert Jan 13, 2023
c173d54
update filnames
BonnieJRobert Jan 13, 2023
40509b2
add helloworld file
Jan 13, 2023
da79723
filenames
BonnieJRobert Jan 13, 2023
c62a683
add helloworld file
Jan 13, 2023
3b6a59b
remove old files
BonnieJRobert Jan 13, 2023
c95c689
rename temp scripts
BonnieJRobert Jan 13, 2023
8df4c3f
update filenames
BonnieJRobert Jan 13, 2023
3eaefee
make skeleton notes
Jan 13, 2023
7d5f747
minor edit
BonnieJRobert Jan 13, 2023
9364353
test variable filename
BonnieJRobert Jan 13, 2023
23f5710
make skeleton notes
Jan 13, 2023
1a66d30
remove tmpfile
BonnieJRobert Jan 13, 2023
33dd933
delete some files as test
BonnieJRobert Jan 13, 2023
09f9336
make skeleton notes
Jan 13, 2023
17c515a
change output folder
BonnieJRobert Jan 13, 2023
ad1a883
make skeleton notes
Jan 13, 2023
92da4fb
clean ./bin
BonnieJRobert Jan 13, 2023
ec8a944
change commit message
BonnieJRobert Jan 13, 2023
ff631b5
add file back for merging
BonnieJRobert Jan 13, 2023
268c5ba
clean course notes
BonnieJRobert Jan 13, 2023
c507a7f
update skeleton notes
Jan 13, 2023
3e6b48a
clean course notes
BonnieJRobert Jan 13, 2023
9aa1122
complete skeleton notes workflow
BonnieJRobert Jan 13, 2023
0c0719e
update skeleton notes
Jan 13, 2023
d7d6a95
add packages
BonnieJRobert Jan 13, 2023
06f4061
minor edits
BonnieJRobert Jan 13, 2023
0bc3cc9
back to merge-able state
BonnieJRobert Jan 13, 2023
9e4f3be
comment out steps to save for future issue
BonnieJRobert Jan 13, 2023
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
5 changes: 5 additions & 0 deletions .github/workflows/bookdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ jobs:
git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:${{ github.ref }}
fi

- name: Update notes
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: bash bin/skeleton.sh
shell: bash

- name: Make course zip
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: Rscript make_course_zip.R
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/skeleton-notes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
on: [push]
# this file requires the following work:
# move "Make course zip" into a shell script so to avoid
# installing R and packages onto runner.

name: skeleton-notes

jobs:
make-skeleton-notes:
runs-on: macOS-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

# - name: Update notes
# run: bash bin/skeleton.sh
# shell: bash

# - name: Commit updated notes
# run: |
# if [[ -n "$(git status --porcelain)" ]]; then
# git add .
# git commit -m 'update skeleton notes'
# git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:${{ github.ref }}
# fi

# - name: Make course zip
# run: Rscript make_course_zip.R

# - name: Commit course zip
# run: |
# if [[ -n "$(git status --porcelain)" ]]; then
# git add intro-to-r-course-notes/. intro-to-r-course-notes.zip
# git commit -m 'make course zipfile'
# git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:${{ github.ref }}
# fi
23 changes: 11 additions & 12 deletions bin/skeleton.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,30 @@
reg="[0-9]{2}"
rpl="---------------------------------------------------------------------"

for x in ds-intro-to-r-2-day/*.Rmd
for x in *.Rmd
do
if ! [[ $x =~ $reg ]]
then
continue
fi

x_out=${x/ds-intro-to-r-2-day\//}
x_out=${x_out/.Rmd/.R}
echo "creating ${x_out} from ${x}"

# delete lines which do not start with hash or caret
x_out=${x/.Rmd/.R}
x_out=intro-to-r-course-notes/"$x_out"
echo "removing old ${x_out} from course notes folder"
rm $x_out

# delete lines which do not start with hash or caret
# delete lines in the challenges between details tags
# add line of dashes below section header lines
# remove trailing dashes under challenge header lines
# remove trailing dashes under challenge header lines

# surround script title with mulitple hashes`
# lines in challenges still start with right angle bracket. replace with hash
# remove trailing information on challenge times
# remove start and end chunk lines
# remove blank lines starting with a hash


echo "creating new ${x_out} in course notes folder"
sed -E \
-e '/^(>|#)/ !d' \
-e '/<details>/,/<\/details>/d' \
Expand All @@ -42,8 +43,6 @@ do
-e 's/(#### Challenge [0-9]\n)//' \
tmpfile.txt > $x_out

done

#rm tmpfile.txt

rm tmpfile.txt

done
115 changes: 63 additions & 52 deletions intro-to-r-course-notes/01-rstudio-intro.R
Original file line number Diff line number Diff line change
@@ -1,63 +1,73 @@
########## Introduction to R and RStudio #########
######### (PART) Fundamentals {-} #########
# Introduction to R and RStudio
## Motivation
## ---------------------------------------------------------------------

## Motivation
## ------------------------------------------------------------------------




## Before Starting The Workshop
## ------------------------------------------------------------------------



## Before Starting The Workshop
## ---------------------------------------------------------------------




## Introduction to RStudio
## ---------------------------------------------------------------------


## Introduction to RStudio
## ------------------------------------------------------------------------




## Work flow within RStudio
## ------------------------------------------------------------------------
## ---------------------------------------------------------------------






## Introduction to R
## ------------------------------------------------------------------------
## ---------------------------------------------------------------------




### Before we dive in...
## ---------------------------------------------------------------------






### Before we dive in...
## Using R as a calculator
## ------------------------------------------------------------------------
## ---------------------------------------------------------------------





# 1 +
## Mathematical functions
## ------------------------------------------------------------------------
## ---------------------------------------------------------------------






## Comparing things
## ------------------------------------------------------------------------
## ---------------------------------------------------------------------






## Variables and assignment
## ------------------------------------------------------------------------
## ---------------------------------------------------------------------






#### Challenge 1
# Which of the following are valid R variable names?
## ---------------------------------------------------------------------




# Which of the following are valid R variable names?
# min_height
# max.height
# _age
Expand All @@ -66,55 +76,56 @@
# min-length
# 2widths
# celsius2kelvin
#### Challenge 2
## ---------------------------------------------------------------------





#### Challenge 2
# What will be the value of each variable after each
# statement in the following program?

# mass <- 47.5
# age <- 122
# mass <- mass * 2.3
# age <- age - 20
#### Challenge 3
## ---------------------------------------------------------------------




#### Challenge 3
# Run the code from the previous challenge, and write a command to
# compare mass to age. Is mass larger than age?
## Vectorization
## ---------------------------------------------------------------------



## Vectorization
## ------------------------------------------------------------------------



## Managing your environment
## ---------------------------------------------------------------------


## Managing your environment
## ------------------------------------------------------------------------




#### Challenge 4
## ---------------------------------------------------------------------




# Clean up your working environment by deleting the mass and age
# variables.
## R Packages
## ---------------------------------------------------------------------



## R Packages
## ------------------------------------------------------------------------




#### Challenge 5
# Install the following packages: `ggplot2`, `dplyr`

## ---------------------------------------------------------------------





# Install the following packages: `ggplot2`, `dplyr`.
61 changes: 42 additions & 19 deletions intro-to-r-course-notes/02-seeking-help.R
Original file line number Diff line number Diff line change
@@ -1,56 +1,79 @@
######### Seeking Help in R #########

## Reading Help files
## ------------------------------------------------------------------------
## ---------------------------------------------------------------------




## Special Operators
## ---------------------------------------------------------------------




## Getting help on packages
## ---------------------------------------------------------------------

## Special Operators
## ------------------------------------------------------------------------


## Getting help on packages
## ------------------------------------------------------------------------

## Finding help for functions in packages
## ---------------------------------------------------------------------

## Finding help for functions in packages
## ------------------------------------------------------------------------


## When you kind of remember the function
## ------------------------------------------------------------------------

## When you kind of remember the function
## ---------------------------------------------------------------------




## When you have no idea where to begin
## ---------------------------------------------------------------------


## When you have no idea where to begin
## ------------------------------------------------------------------------


#### Challenge 1
## ---------------------------------------------------------------------




# Look at the help for the `sum()` function. What are two ways you can pass numbers
# into the function so the are added together?
## Challenges (10 minutes)
## ---------------------------------------------------------------------




#### Challenge 2
## ---------------------------------------------------------------------




# Look at the help for the `paste()` function. You'll need to use this later.
# What is the difference between the `sep` and `collapse` arguments?
#### Challenge 3
## ---------------------------------------------------------------------




#### Challenge 3
# Use help to find a function (and its associated parameters) that you could
# use to load data from a csv file in which columns are delimited with "\t"
# (tab) and the decimal point is a "." (period). This check for decimal
# separator is important, especially if you are working with international
# colleagues, because different countries have different conventions for the
# decimal point (i.e. comma vs period).
# hint: use `??csv` to lookup csv related functions.




#### Challenge 4
# Find the help for the `mutate` function in the `dplyr` package.
# What is its purpose? What do you notice different about this help page?
## ---------------------------------------------------------------------




# Find the help for the `mutate` function in the `dplyr` package. What is its purpose? What do you notice different about this help page?
Loading