Finish setting up RStudio

You will need:

  1. RStudio (comes with pandoc)
  2. Latex to output PDFs. Mac users install MacTex. Windows users install TinyTex. See a more extensive instruction here.

Render this Rmd document in html and pdf formats

In RStudio, simply use the Knit dropdown menu to produce PDF and/or html documents.

Example plot

Feel free to change the following code chunk (you do not have to). Two graphs with different Y axis scale should appear in the final output if this Rmd runs correctly.

# read data
milk <- read.csv("milk.csv", header = FALSE, as.is = TRUE)

# set up parameter for graph
par(las = 1, tcl = -0.2, mar = c(1, 2.5, 1.5, 0), ps = 7, lwd = 0.5, xpd = TRUE)

# plot data points
plot(milk[, 1], milk[, 3], ylim = c(0, 30000), type = "l", axes = FALSE, xlab = "", ylab = "", lwd = 2, col = "grey50")

# add X and Y axes
axis(side = 1, lwd = 0.5, cex.axis = 6/par("ps")/par("cex"), mgp = c(1, -0.1, 0))
axis(side = 2, lwd = 0.5, cex.axis = 6/par("ps")/par("cex"), mgp = c(2.5, 0.3, 0))

# add axis titles
title(ylab = "Average milk production (lbs)", mgp = c(1.5, 0, 0), cex.lab = 7/par("ps")/par("cex"))
title(main = "Phenotypic trend for milk production (Holstein or Red and White)")

# add box
box(bty = "l")

# read data
milk <- read.csv("milk.csv", header = FALSE, as.is = TRUE)

# set up parameter for graph
par(las = 1, tcl = -0.2, mar = c(1, 2.5, 1.5, 0), ps = 7, lwd = 0.5, xpd = TRUE)

# plot data points
plot(milk[, 1], milk[, 3], ylim = c(8000, 30000), type = "l", axes = FALSE, xlab = "", ylab = "", lwd = 2, col = "grey50")

# add X and Y axes
axis(side = 1, lwd = 0.5, cex.axis = 6/par("ps")/par("cex"), mgp = c(1, -0.1, 0))
axis(side = 2, lwd = 0.5, cex.axis = 6/par("ps")/par("cex"), mgp = c(2.5, 0.3, 0), at = c(8000, seq(10000, 30000, 5000)), labels = c(0, seq(10000, 30000, 5000)))

# add axis titles
title(ylab = "Average milk production (lbs)", mgp = c(1.5, 0, 0), cex.lab = 7/par("ps")/par("cex"))
title(main = "Phenotypic trend for milk production (Holstein or Red and White)")

# add box
box(bty = "l")

# add Y axis break
axis.break(axis = 2, breakpos = 9000, style = "zigzag")

Short essay

Write a short essay on a good and/or a bad graph you have seen recently in a research paper. Embed your chosen graph in this document using the following syntax. Be sure to include citation.

![Caption!](path-to-png-file)

This is the Spartan helmet (caption)!
This is the Spartan helmet (caption)!