---
title: "Cleaning and Shaping Data problems"
output: word_document
...

```{r, include = FALSE}
library(tidyverse)
library(HumanitiesDataAnalysis)
knitr::opts_chunk$set(eval=FALSE)
```

<h2 id="exercises-cleaning-and-tidying-data">Exercises: Cleaning and Tidying data</h2>
<p><a href="extracted_problem_sets/4-Cleaning_and_Shaping.Rmd" target="_blank">Download these problems</a></p>
<h3 id="assigning">Assigning</h3>
<ol type="1">
<li>The <code>crews</code> database has columns for feet and inches, but no column for ‘height’. Make one, where height is measured in feet, inches, or something else.</li>
</ol>
<p>```{r eval = FALSE}</p>
<p>crews %&gt;% mutate( KEEP_GOING )</p>
<p>Fix the following line of code so it gives (2,3,4)</p>
<p>```{r run = FALSE}</p>
<p>c((1, 2, 3) + 1</p>
<p>```{r class.source=“answers”}</p>
<p>count = 1 + 2</p>
<p>```{r class.source=“answers”} # For two: crews %&gt;% filter(is.na(feet), !is.na(Height)) %&gt;% select(Height)</p>
<p><code>{r class.source="answers"} crews %&gt;%   mutate(year = lubridate::year(date)) %&gt;%   count(Rig, year) %&gt;%   pivot_wider(names_from = year, values_from = n)</code></p>
<ol start="3" type="1">
<li>There’s another dataset. It was created by the <a href="https://cesta.stanford.edu/">Center for Spatial and Textual Analysis at Stanford</a>. Read it in. We’ll be working with this data set more next week.</li>
</ol>
<p>``` {r eval=FALSE}</p>
<p>CESTA %&gt;% head()</p>
<ol start="5" type="1">
<li>Use the <code>?</code> command or the help pane to read about the function <code>write_csv</code>. Save the result to disk: we’ll be exploring it more next week.</li>
</ol>
