Homework 7

Due: 2024-04-02, 11:59pm

Submission instructions

For this homework you should submit a ZIP archive containing:

  • A single document with the answers to all the following items in HTML format only. Make sure you include plain English blocks in between the code, and its output to interpret what R is giving you.
  • Code file used to generate the answers (RMD format). There should be comments in the code blocks.

  • Jupyter notebook (IPYNB) is okay.
  • Please remember to mix your comments with code and output.
  • Do not forget acknowledgements.

In this homework we will work on data entry and wrangling using Tidyverse.

1. NBA league table for 2017-2018 season (50%)

This data is in the small data repository. Create the league standings table with the following columns: Team name, wins, losses, win proportion, points scored per game, points against per game.

You do not have to create the SRS, and GB columns.

You are free to do it any way you want. Minimize repetitive code. The code should run on a different computer if cut and pasted onto the R terminal. The steps for getting the standings table are similar to that for creating the EPL standings table.

The following steps might be helpful.

  • Read in the data in different files into separate tibbles. You may want to rename the columns.
  • Remove games on or after 2018-04-14 as those are playoff games. You may use the filter function after parsing dates (using parse_date) or you may just select the needed rows by counting.
  • Put all the tibbles together using rbind or other similar function so that you have one tibble with all the games.
  • (Optional) Count home and away games for each team as a check.
  • (Optional) Separate standings by conference.

2. Frog abnormalities (50%)

We will use the Frog abnormalities data. Read in the files FrogAbnormalities.csv and AnalyticResults.csv files.

The first file gives information on abnormalities, size, and developmental stage for the over 9,000 frogs examined for abnormalities on the Kenai Peninsula from 2000 through 2012.

The second file provides analytical chemistry information for metals, anions, and organic carbon concentrations in wetland water, sediment, tadpole tissue, and soil, dust, and snow collected on transects from roads adjacent to the wetlands from 2010-2012.

  • Calculate the average proportion of abnormal frogs at each site (using the first file).
  • Calculate the average concentration of sodium (Na) dissolved (method) in water (media) at each site (using the second file).
  • Create a data frame with a list of all sites, the proportion of abnormal frogs at each site, and the dissolved sodium concentration in water at each site.

3. Acknowledgements

Cite resources or individuals helping you.