A) Prepare for in-class exercises for
Day1: Functions in R (50 min)
Instructions
- Create a new Rmd file, save it in your document folder with the name
"functions-prep.Rmd"
.- Write a title for this section (using a first level header, indicated with one hashtag followed by a blank space
#
)- After (or during) watching each video, write the code that is being explained by the virtual instructor in your Rmd file.
- Write a subtitle before the code section of each video (as a second level header indicated with two hastags followed by a blank space
##
).- Write each piece of code explained in the video in its own R chunk.
- ⚠️ If the code gives an error or does not run, you can tell R not to run it by using the option
eval = FALSE
inside the R chunk:```{r, eval = FALSE} your code that does not run goes here. ```
- Knit to pdf.
- Git add, commit and push both files (Rmd and PDF).
- Watch the 12min 56s video Writing Your Own Functions in R.
- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
- Watch the 8min 46s video How Functions Execute.
- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
- Watch the 4min 20s video Setting Default Values for Arguments.
- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
- Watch the 5min 19s video When To Use Named And Unnamed Arguments.
- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
- Watch the 8min 35s video Combining Functions.
- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
- Watch the 4min 32s video Calling Functions From Inside Other Functions.
- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
- Watch the 4min 11s video RStudio Tips and Tricks for Working With Functions.
- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
B) Prepare for in-class exercises for
Day 2: Making choices inside R functions (42 min)
Instructions
- Create a new Rmd file, save it in your document folder with the name
"choices-prep.Rmd"
.- Write a title for this section (using a first level header, indicated with one hashtag followed by a blank space
#
)- After (or during) watching each video, write the code that is being explained by the virtual instructor in your Rmd file.
- Write a subtitle before the code section of each video (as a second level header indicated with two hastags followed by a blank space
##
).- Write each piece of code explained in the video in its own R chunk.
- ⚠️ If the code gives an error or does not run, you can tell R not to run it by using the option
eval = FALSE
inside the R chunk:```{r, eval = FALSE} your code that does not run goes here. ```
- Knit to pdf.
- Git add, commit and push both files (Rmd and PDF).
- Watch the 11min 51s video Introduction To Conditional Statements.
- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
- Watch the 7min 17s video Introduction To
if
Statements In R.- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
- Watch the 9min 17s video Introduction To
else if
Andelse
Statements in R.- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
- Watch the 6min 36s video Using
if/else if/else
Statements Inside of Functions in R.- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
- Watch the 6min 10s video Introduction To Nested
if
Statements in R.- Write a subtitle header for this section.
- Write and run the code that was explained on the video.