A) Prepare for in-class exercises
The apply
family of functions
Watching all videos for this section takes ~ 44 min.
Hint: Watch the videos with a higher reproduction speed to save some time.
Instructions
- Create a new Rmd file, save it in your document folder with the name
"apply-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 4min 11s video Introduction to repeating things in R.
- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
- Watch the 11min 32s video Using vectorized functions.
- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
- Watch the 8min 38s video
Apply
functions.- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
- Watch the 5min 31s video The
mapply
function.- Write a subtitle header for this section.
- Write and run the code that was explained on the video.
- Watch the 15min 07s video Combining functions with
dplyr
.- Write a subtitle header for this section.
- Write and run the code that was explained on the video.