--- title: "Module 1, Assignment 3: Getting to Know Your Home" author: "Ellen Bledsoe, Lily McMullen" format: html execute: eval: false --- ```{r} #| include: false knitr::opts_chunk$set(echo = TRUE) ``` # Assignment Description ### Purpose The goal of this assignment is to get comfortable using the `tidyverse` with 2-dimensional data sets (data frames). ### Task Write R code using the `tidyverse` to successfully answer each question below. ### Criteria for Success - Code is within the provided code chunks - Code chunks run without errors - Code produces the correct result - Code that produces the correct answer will receive full credit - Code attempts with logical direction will receive partial credit - Written answers address the questions in sufficient detail # Assignment Questions For this final assignment for Module 1, you'll be working with another real-world data set: a collection of data from climate stations scattered across Antarctica. 1. In your own words, describe what the `tidyverse` is. Your answer should be between 1-3 sentences. *Answer:* 2. Load in the `tidyverse` package. ```{r} # Write your code here ``` 3. In your data folder, look for the data file called `aggregated_station_data.csv` and load it in using the `read_csv()` function. Save the data as an object called `weather`. ```{r} # Note: use the read_csv function, not the read.csv function! # Write your code here ``` 4. Take a look at the data in whichever way you would like (looking in the environment, viewing the data, typing a function into the console below, etc.). How many rows and columns are in the data? Type your answers below: rows:\ columns: ```{r} # using code is optional for Question 4 ``` 5. Write some code to choose rows that only include temperatures which are above freezing (AKA greater than 0 because the temperature is currently in Celsius) ```{r} # Write your code here ``` 6. Write some code to choose *only* columns with the following information: the year, day, month, temperature, and the station ID. Save these columns as a new object called `station_temp`. ```{r} # Write your code here ``` 7. Using the data frame you created in Q6 above (`station_temp`), add a new column to that data frame that converts the temperature column (currently in Celsius) to Fahrenheit. Call the new column `tempF`. *Hint: we did this in class, use that same equation!* ```{r} # Write your code here ``` 8. In your own words (either bullet points or sentence form is fine), explain two benefits of using the pipe (`%>%`). *Answer:* 9. Using the *original* data frame (`weather`), find the minimum (`min()`) temperature recorded for each month (in Celsius, the original column). *Hint: think about months first (split) and then temperature (apply). You will also want to remove all the `NA` values.* ```{r} # Write your code here ``` 10. Again, using the *original* data frame, produce a data frame with the average temperature in the month of January for each station. Some hints: - take note of how months are represented in the data - think about using the pipe, how we choose which rows we want, and how we split-apply-combine - remember to remove the `NA` values! ```{r} # Write your code here ``` ## Bonus! (up to 2 points) Write code to determine how many unique stations are in the `weather` data set. (Hint: look up the help files for the `distinct()` and the `count()` functions). ```{r} # Write your code here ``` # Turning in Your Assignment 1. Make sure your name is filled in at the top of the document. 2. Click the **Render** button at the top of this document. This will produce an HTML file that opens in a new tab and also saves to the Files panel on the bottom-right of your screen. 3. To download the HTML file from Posit Cloud, click the empty box to the left of it in the Files panel. 4. Click the blue gear at the top of the Files panel and choose Export. 5. Put your last name at the front of the file name when prompted, then click Download. The file is now in your Downloads folder.