-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathassignment-01.Rmd
68 lines (59 loc) · 3.01 KB
/
assignment-01.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
title: 'Assignment 1: Intro to programming (4 marks)'
output:
html_document:
toc: false
---
*To submit this assignment, upload the full document on Quercus,
including the original questions, your code, and the output. Submit
your assignment as a knitted `.pdf` (prefered) or `.html` file.*
1. Get set up at home (or on a lab computer after hours). (1.5 marks)
- Install [R](https://cran.rstudio.com/) and
[RStudio](https://www.rstudio.com/products/rstudio/download/)
(already installed on the lab computers).
- Open a new R Notebook and read the instructions about how to use
the R Markdown syntax.
- Open this assignment file (`assignment-01.Rmd`) in RStudio or
copy its content into an empty R Notebook.
- Insert a code chunk below, above question 2.
- In the code chunk, use `install.packages("<package_name>")` to
install `tidyverse` and `rmarkdown`. Remember to run the code
chunk to execute the commands.
- Load the two libraries you just installed into your environment
with `library(<package_name>)` (no surrounding quotation marks
as with `install.packages()`). Add this to the same code chunk
you created previously and execute it again (don't worry that
the `install.packages()` commands have already been executed
once, R is smart and checks if you already have those
installed).
- Run `sessionInfo()` to list all the loaded packages.
- You should see the following packages under "other attached
packages": `rmarkdown`, `dplyr`, `purrr`, `readr`, `tidyr`,
`tibble`, `ggplot`, and `tidyverse`.
- Since this is your first assignment, we have already completed
most of this question below. You still need to run the code
chunk on your computer to confirm that the packages installed
without errors and to get the `sessionInfo()` output for your
computer. You might receive warnings that functions from other
packages are masked when you load `tidyverse`, this is fine.
```{r}
install.packages("tidyverse")
install.packages("rmarkdown")
library(tidyverse)
library(rmarkdown)
sessionInfo()
# Expected answer
# The output is included below this code chunk with the appropriate
# packages loaded.
```
2. What is R Markdown and why are we using it in this class? *Hint:*
You are using R Markdown right now to complete this assignment! (1
mark)
- Which key combination would you use to insert a chunk of code in
an R Markdown document?
- Which key combination would you use to execute a code chunk?
3. Provide a few reasons as to why it is beneficial to create documents
like R Notebooks rather than using spreadsheet software for
exploratory data analyses. (1 mark)
4. Fill out the pre-course survey posted on Quercus. Type your student number
below to confirm that you are done. (0.5 marks)