Files and Folders

It is essential that you name your folders and files exactly as specified. We will run checks like

cd HW1
Rscript -e 'rmarkdown::render("hw1.Rmd")'

from the top of a clone of your repository. If the folders and files are not named exactly as specified these checks will fail.

Consistent file naming is often an important part of a data analysis project. Consistent use of upper and lower case letters is important for an analysis to be reproducible. These may seem like small issues, but if your files do not use the conventions your code expects then the code will fail.

There are two kinds of file systems in common use:

To make your work as reproducible as possible:

Reproducibility

Make sure your .Rmd file will knit without errors.

For now, if your submission does not knit successfully on our test systems (the CLAS Linux systems) we will:

Rmarkdown Usage and Coding Style

Make sure you are using Rmarkdown properly, with explanatory texts surrounding short code chunks. In particular you should not have just one big code chunk.

Name and Date

Make sure your Rmarkdown file header contains a name: field with your name; a date: field with an appropriate date is also useful.

Your header should look something like this:

---
title: "Assignment 1"
output: html_document
name: "Your  Name"
date: "January 26, 2022"
---

The template shows a way to have the current date inserted.

The following is a sample solution.

1. Average Waiting Time Between Eruptions

The average waiting time between eruptions of the Old Faithful geyser in the data set faithful is 70.9 minutes.

2. First Four Eruption Durations

The first four eruption durations can be computed using by using the $ operator to extract the eruptions variable, and then the subset operator to get the subset of the first four observations:

faithful$eruptions[1 : 4]
## [1] 3.600 1.800 3.333 2.283

3. First Five Records of the Eruptions Data

The following table shows the first five eruption durations and waiting times to the subsequent eruption for the Old Faithful geyser recorded in the faithful data frame. Times are in minutes.

eruptions waiting
3.60 79
1.80 54
3.33 74
2.28 62
4.53 85

4. Histogram of Eruption Durations

The following plot shows a histogram of the eruption durations for the faithful data set.

The distribution appears to be bimodal, with one mode around 2 minutes and one around 4.5 minutes.

LS0tCnRpdGxlOiAiQXNzaWdubWVudCAxIE5vdGVzIgpvdXRwdXQ6CiAgaHRtbF9kb2N1bWVudDoKICAgIHRvYzogeWVzCiAgICBjb2RlX2Rvd25sb2FkOiB0cnVlCi0tLQoJICAKYGBge3IgZ2xvYmFsX29wdGlvbnMsIGluY2x1ZGUgPSBGQUxTRX0Ka25pdHI6Om9wdHNfY2h1bmskc2V0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