---
title: "Sea ice vignette"
author: "Scott Chamberlain"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Sea ice vignette}
  %\VignetteEngine{knitr::rmarkdown}
  \usepackage[utf8]{inputenc}
---

```{r, echo = FALSE, warning = FALSE, message = FALSE}
knitr::opts_chunk$set(
  collapse  =  TRUE,
  comment  =  "#>",
  purl  =  FALSE,
  eval  =  FALSE
)
```

Get sea ice data at <ftp://sidads.colorado.edu/DATASETS/NOAA/G02135/shapefiles>

********************


```{r}
library('rnoaa')
library('dplyr')
library('ggplot2')
```

### Look at data for a series of years for Feb, South pole

```{r eval=FALSE}
res <- sapply(seq(1986, 1990, 1), function(x)
    sea_ice(x, month = 'Feb', pole = 'S'))
lapply(res, head)
```

### Map a single year/month/pole combo

```{r seaice1, eval=FALSE}
ggplot(res[[1]], aes(long, lat, group=group)) +
    geom_polygon(fill="steelblue") +
    theme_ice()
```

### Map all years for April only for North pole

```{r seaice2, eval=FALSE}
dat <- sea_ice(year = 1985:1990, month = 'Apr', pole = 'N')
df <- bind_rows(dat, .id = "x")
ggplot(df, aes(long, lat, group = group)) +
  geom_polygon(fill = "steelblue") +
  theme_ice() +
  facet_wrap(~ x)
```
