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 and RStudio (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.

      ## Installing package into '/home/travis/R/Library'
      ## (as 'lib' is unspecified)
      ## Installing package into '/home/travis/R/Library'
      ## (as 'lib' is unspecified)
      ## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
      ## ✔ ggplot2 3.2.1     ✔ purrr   0.3.3
      ## ✔ tibble  2.1.3     ✔ dplyr   0.8.4
      ## ✔ tidyr   1.0.2     ✔ stringr 1.4.0
      ## ✔ readr   1.3.1     ✔ forcats 0.4.0
      ## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
      ## ✖ dplyr::filter() masks stats::filter()
      ## ✖ dplyr::lag()    masks stats::lag()
      ## R version 3.6.2 (2017-01-27)
      ## Platform: x86_64-pc-linux-gnu (64-bit)
      ## Running under: Ubuntu 14.04.5 LTS
      ## 
      ## Matrix products: default
      ## BLAS:   /home/travis/R-bin/lib/R/lib/libRblas.so
      ## LAPACK: /home/travis/R-bin/lib/R/lib/libRlapack.so
      ## 
      ## locale:
      ##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
      ##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
      ##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
      ##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
      ##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
      ## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
      ## 
      ## attached base packages:
      ## [1] stats     graphics  grDevices utils     datasets  methods   base     
      ## 
      ## other attached packages:
      ##  [1] rmarkdown_2.1   forcats_0.4.0   stringr_1.4.0   dplyr_0.8.4    
      ##  [5] purrr_0.3.3     readr_1.3.1     tidyr_1.0.2     tibble_2.1.3   
      ##  [9] ggplot2_3.2.1   tidyverse_1.3.0
      ## 
      ## loaded via a namespace (and not attached):
      ##  [1] tidyselect_1.0.0 xfun_0.12        haven_2.2.0      lattice_0.20-38 
      ##  [5] colorspace_1.4-1 vctrs_0.2.2      generics_0.0.2   htmltools_0.4.0 
      ##  [9] yaml_2.2.1       rlang_0.4.4      pillar_1.4.3     withr_2.1.2     
      ## [13] glue_1.3.1       DBI_1.1.0        dbplyr_1.4.2     modelr_0.1.5    
      ## [17] readxl_1.3.1     lifecycle_0.1.0  munsell_0.5.0    gtable_0.3.0    
      ## [21] cellranger_1.1.0 rvest_0.3.5      evaluate_0.14    knitr_1.28      
      ## [25] fansi_0.4.1      broom_0.5.4      Rcpp_1.0.3       scales_1.1.0    
      ## [29] backports_1.1.5  jsonlite_1.6.1   fs_1.3.1         hms_0.5.3       
      ## [33] digest_0.6.24    stringi_1.4.6    grid_3.6.2       cli_2.0.1       
      ## [37] tools_3.6.2      magrittr_1.5     lazyeval_0.2.2   crayon_1.3.4    
      ## [41] pkgconfig_2.0.3  xml2_1.2.2       reprex_0.3.0     lubridate_1.7.4 
      ## [45] assertthat_0.2.1 httr_1.4.1       rstudioapi_0.11  R6_2.4.1        
      ## [49] nlme_3.1-142     compiler_3.6.2
  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)


This work is licensed under a Creative Commons Attribution 4.0 International License. See the licensing page for more details about copyright information.