---
title: Syllabus
author: "Eric C. Anderson"
output:
  html_document:
    toc: yes
  bookdown::html_chapter:
    toc: no
layout: default_with_disqus
---

```{r, echo=FALSE}
# in true geek fashion I am going to use R to calculate the dates
# by giving the week of the course and the day to some functions
# in lubridate.  This way I can change the course to a different
# season and or format, and Voila! All the dates change appropriately.
library(lubridate)
StartSun <- ymd("20141005")  # Sunday of the week that the course starts
WD <- (1:7)
names(WD) <- c("Su", "Mo", "Tu", "We", "Th", "Fr", "Sa")
LWD <- c("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
names(LWD) <- names(WD)
# given day D (like "Tu"), and Week of course W (1, 2, etc.)
# and the date of the sunday before the first course meeting
# this formats a string to print for a heading below
course_day <- function(D, W) {
  c_date <- StartSun + weeks(W-1) + days(WD[D]-1)
  paste(LWD[D], ", ", month(c_date, label = TRUE, abbr = FALSE), " ", mday(c_date), ", ", year(c_date), sep="")
}
```


# Syllabus  {#syllabus}

Here is the outline of the topics, readings, and assignments for our
course.  Readings should be done _before_ the session that they are listed
for.  For example, if it says Reading X is for Tuesday Oct 14, then 
you should have done that reading prior to coming to the class at 
3:30 on Oct 14.  

Most assignments will be "turned in" on GitHub, and will be due at the
time stated.  Don't let this get your blood pressure up.  This course is
not for credit and you will not be graded.  But you will learn a lot more
and you will be far more likely to benefit from using R and git and GitHub if
you do the assignments.


## Week 1 {#syl-week-1}

### `r  course_day("Tu", 1)`
_Introduction and Welcome. R and Rstudio very basics_

* __Assignment Due:__ [Assignment 0](#assignment-0).  Please have all software installed before showing up to the first class.
* __Assignment Given (Due by noon on Wednesday):__ [Assignment 1](#assignment-1)
* __Lectures:__
    + [Introduction](#intro-lecture)
    + [Rstudio Orientation](#rstudio-orientation)


### `r  course_day("Th", 1)`
_An introduction to R markdown_

* __Assignment Due:__ [Assignment 2](#assignment-2). There is nothing to turn in, but I want everyone to do this.
* __Assignment Given (Please finish by Wednesday night next week!):__ [Assignment 3](#assignment-3).
  You will write about yourself and your research using R markdown.
* __Lectures:__
    + [R Markdown in an Hour](#rmarkdown-in-an-hour)
 
## Week 2 {#syl-week-2}

### `r  course_day("Tu", 2)`
_Atomic data types, Vectorization, Indexing in R_

* __Reading:__ By this class, I would like you to have read the [Introduction](http://adv-r.had.co.nz/Introduction.html) to Hadley Wickham's advanced R book, up to, but not including, "Meta-techniques". Then, please read through [Data structures](http://adv-r.had.co.nz/Data-structures.html) up to "Attributes".  This is very terse and will likely feel foreign to most newcomers to R, but precisely because it is short and compact (and very informative) it is worth coming back to frequently.  We will go over the topics in more detail.
* __Lectures:__
    + [Atomic Data Modes and Coercion](#r-data-types-and-coercion)
    + [Vectorization, Recycling, and Indexing](#vectorization-and-indexing)


### `r  course_day("Th", 2)`
_git Overview.  Configuring git_

* __Reading:__ Read sections 1.1 through 1.3 in the [Pro Git Book](http://git-scm.com/book) which is online and free.
* __Assignment Due:__ [Assignment 3](#assignment-3). You should have completed this the day before this course session.
* __Lectures:__
    + [Git Basics](#git-basics)


## Week 3 {#syl-week-3}

### `r  course_day("Tu", 3)`
_Attributes. Length of vectors. Names_

* __Assignment Due:__ _Exercise Set 1_, named [Trial Homework](#ex-test-start).  I emailed this out to people Saturday night.  I would like everyone
to try to complete it by Tuesday.  At least give it a whirl.  It is called
Trial Homework because it is not very long.  Mostly the goal is to figure out how
to commit your changes and make a GitHub pull request. It would be good to be
able to discuss it in class after everyone has at least tried to complete it.
* __Lectures:__
    + [length() and names()](#attr-length-names)
    + [Comments on the homework](#trial-homework-thoughts)

### `r  course_day("Th", 3)`
_git: Branching and Merging_

* __Reading__:  I don't expect people
to have finished this reading before class because I didn't post it till Thursday.  We will be covering material
in these readings, so it would be good for you to read one or both of them to solidify ideas.  Either:
    + Read chapter 3 of the [Pro Git Book](http://git-scm.com/book). 
    + __OR__
    + Read [this excellent tutorial](https://www.atlassian.com/git/tutorials/using-branches) on branching and merging    
    + __OR__ read them both.
* __Lecture:__
    + [Branching and merging](#branch-and-merge)



## Week 4 {#syl-week-4}

### `r  course_day("Tu", 4)`
_Lists: aka "recursive vectors"_

* __Reading__: In case you were wondering why you are going through the grueling
work of learning R and git, Devon Pearse found this excellent post from Carly Strasser
at the California Digital Library that makes a good case for sticking with it!
http://datapub.cdlib.org/2014/10/14/the-10-things-every-new-grad-student-should-do/
Everyone, please read this!
* __Lecture:__
    + [An introduction to lists](#lists-lecture)


### `r  course_day("Th", 4)`
_Merge conflicts, stashing, remotes_

* __Reading__: 
    + [Hilarious analogizing between git and "X-men: Days of Future Past"](http://hashrocket.com/blog/posts/x-men-days-of-future-past-explained-in-git).  This is worth a read, even if we haven't explored all these
layers of git.  Thanks to Anthony Clemento for finding this.
    +[ProGit Book: git password caching](http://git-scm.com/book/en/v2/Git-Tools-Credential-Storage#_credential_caching) 
    If you are tired of typing your password in every time you push or pull.  Read this!
* __Assignment Due:__ _Exercise Set 2_, named [Homework 2](#hw2-start).  A collection of exercises on 
vectorization, recycling, indexing, and names.  Instructions are on the page. I emailed
this out on Sunday night. It's another GitHub submission.
* __Lecture:__
    + [Merge conflicts, stashing, remotes](http://eriqande.github.io/rep-res-web/lectures/conflicts-stashing-remotes.html)

## Week 5 {#syl-week-5}

### `r  course_day("Tu", 5)`
_Data Frames. Reading in data, etc_

* __Lecture:__
    + [Introduction to Data Frames](#data-frame-lecture)


### `r  course_day("Th", 5)`
_Factors. Some GitHub Basics_

* __Reading:__ please download [The R Inferno](http://www.burns-stat.com/pages/Tutor/R_inferno.pdf)
and read the Preface on page 8 and the first few
paragraphs of Chapter 1 (because it is fun
to do so---we have all been in R hell at one time or another), then read from section 8.2 through 8.2.8, which 
covers factor hell.
* __Lecture:__
    + [More about factors](#factor-lecture)
    + [Putting your own repositories on GitHub](#put-it-on-github)

## Week 6 {#syl-week-6}

### `r  course_day("Tu", 6)`
_NO CLASS. VETERANS DAY_


### `r  course_day("Th", 6)`
_NO CLASS._
* There was a conflict with the room and this seemed like a good time for
everyone to start loading their own data into R and working with it.



## Week 7 {#syl-week-7}

### `r  course_day("Tu", 7)`
_Plotting. ggplot and the grammar of graphics_

* __Lecture:__
    + [Introduction to ggplot](#ggplot2-intro-lecture)


### `r  course_day("Th", 7)`
_Plotting with ggplot_

* __Lecture:__
    + [More ggplot. Reshaping](#ggplot2-second-lecture)


## Week 8 {#syl-week-8}

### `r  course_day("Tu", 8)`
_NO CLASS. THANKSGIVING WEEK_
* __Reading:__ Download the [Tidy Data](http://vita.had.co.nz/papers/tidy-data.pdf) article by Hadley and read it.
* __Watch a Video!__ Take 45 minutes to watch the video tutorial on the `dplyr` package that we will take about 
after we come back from Thanksgiving.  It is on this page:  http://www.dataschool.io/dplyr-tutorial-for-faster-data-manipulation-in-r/




### `r  course_day("Th", 8)`
_NO CLASS. THANKSGIVING WEEK_


## Week 9 {#syl-week-9}

### `r  course_day("Tu", 9)`
_String Manipulation and Text Processing in R_

* __Lecture:__
    + [String Manipulation](#string-manipulation)

### `r  course_day("Th", 9)`
_A more formal look at functions. lapply()_

* __Lecture:__
    + [Functions and lapply](#functions-and-lapply)

## Week 10 {#syl-week-10}

### `r  course_day("Tu", 10)`
_Plotting on top of maps in R_

* __Lecture:__
    + [Making maps with R](#map-making-in-R)

### `r  course_day("Th", 10)`
_NO CLASS. NMFS LAB PARTY_



## Week 11 {#syl-week-10}

### `r  course_day("Tu", 10)`
_NO CLASS_



