Data cleanup with Tidyr

Please submit the following as an RMD as well as the knitted HTML file.

1. Warmup with some Faded Examples!

Please provide one example per chunk in your RMD file.

Grab Sale_Prices_City.csv and bring it in to R, link to data here.

First, convert it from wide to long, with a column for year/month called time_point.

sales_long <- sales %>%
    ______(___ = time_point, 
           _____ = sale_price, 
           cols = -c(_________:_________))

Drop the NAs

sales_long <- sales_long %>%
    ______(______(sale_price))

Split up year and month into two columns

library(dplyr)
library(stringr)

sales_long <- sales_long %>%
    ____(year = str_split(time_point, "____", simplify=TRUE)[,____],
           month = ____(time_point, "____", ____=____)[,____],
           )

Make the following string:

my_string <- "Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems."

Make it all uppercase

__________(my_string)

Remove all instances of the letter e

______________(my_string, ______ = "e", replacement = ___)

Remove all instances of the letter e

Split this string into a vector of individual words

split_string <- __________(my_string, pattern = ___, simplify = ______)

Find the words that start with consonants.

str_____(split_string, "___________")

2. Tidying the HadCrut Data

Load up the raw hadcrut data, link here. We’ve been using this in a long format, but it actually is supplied as wide data. Use your skills with tidyr to make it look like the long data we’ve been using in class!

Make sure in this exercise you submit: Code required for loading data, converting to long format, and then use head() to display the first five lines.Be sure to include steps where you check your work with str and and explain the relavent parts of what you see! Feel free to do this in comments. an example of this could be:

#First I will create a vector of 100 random numbers between 0 and 1 using runif
x <- runif(100)
#I will then use mean to find the average of this vector
mean(x)
## [1] 0.5062099

I want to know that you know what your code is doing!

3. Bob Ross!

Finish your lab from https://biol355.github.io/Labs/bob_ross_tidy.html

4. Your package!

A. What are the most interesting things your package does? Provide examples of each.
B. What are the most essential things your package does - that everyone will want to use it for. Provide examples of each.
C. How does your package complement/enhance/make use of tools already in the R ecosystem? Give examples!

5. Your cheat sheet!

A. In what order would you provide information about this package in a cheat sheet?
B. Based on all of the above, make a sketch of your cheatsheet. This can be on paper, powerpoint, using the template, not using it, whatever. Make a rough sketch showing what you’d show off, and in what format. Scan it, and attach the image to your homework.