Assignment 1

Reproducible Rmarkdown Document: 10 pts

Due: February 13th, 2021 - No penalty for late submissions, but due no later than May 8th.


For this assignment, you will create your first reproducible R Markdown document. The source file (the .Rmd) file will be turned in as well as the compiled version (html). The general form of the R code to be included in the document will be given to you. You may be asked to manipulate simple R commands. Submit completed assignment, including Rmd and html to ICON.

R Markdown Setup

  1. Using RStudio, open up a new template for an R Markdown file. To do this, go to File > New File > R Markdown.
  2. A new window should open up, type in the details, and ensure that HTML Output is clicked. When finished entering in details, click the ‘okay’ button.
  3. Upon hitting the ‘okay’ button, a document template should show up. Read the elements in the template, then once comfortable with its contents, you can delete it and continue to the questions below.

Questions

  1. Using Markdown syntax, create a header that says Question 1. Note, you can pick any level of header you wish. Create subsequent headers for each question below. 1 pt

  2. Create an unordered list that lists your research interests (please list at least 2 interests here). 1 pt

  3. Create a hyperlink (link to a webpage) that links to the main R project website. Add the link in two ways, one that show the actual link and two, one that has the link embedded within text. You can pick whatever you wish for the link text. 1 pt

  4. Add a R code chunk to the document. Within this code chunk add the following R code: summary(iris). Ensure to give the chunk a unique name. 1 pt

  5. Using output from the R command used in the code chunk from question 4, create a table that summarizes the first four variables from the output. The syntax to create a table manually can be found in the Extended Markdown Syntax. More specifically, create a simple table by hand that describes the first row or two from the output of question 4. 1 pt

  6. Add a new R code chunk. Inside this code chunk add the following R code: hist(iris$Sepal.Length). Ensure to give the chunk a unique name and also add the chunk option to omit the code from being shown in the output. 1 pt

  7. Create an ordered list with Markdown that ranks your top vacations you have taken. Within each of your top vacations, add a nested item (e.g. https://commonmark.org/help/tutorial/10-nestedLists.html or https://www.markdownguide.org/basic-syntax#lists-1) to each of your vacations that states the top activities you did while on vaction. 1 pt

  8. Write some text that specifies the correlation between the continuous variables from the iris data. Place the following two bits of code inline in their relevant positions. The two correlations can be calculated with the following bit of code: round(cor(iris$Sepal.Length, iris$Sepal.Width), 2) and round(cor(iris$Petal.Length, iris$Petal.Width), 2) 1 pt

  9. Let’s now create another figure with the following R code, plot(iris$Sepal.Length, iris$Sepal.Width). Similar to above, give the chunk a unique name and also add the chunk option to omit the code from being shown in the output. For this figure, explore the knitr chunk options (https://yihui.name/knitr/options/) to add a figure caption to the figure. 1 pt

  10. Add one last code chunk (ensure this chunk has a unique name). Ensure through chunk options that the code is not evaluated, but the code is returned. 1 pt

x <- rnorm(100)
y <- runif(100, min = 3, max = 8)
mean(x)
mean(y)
Next