Homework 8

Due: 2024-04-09, 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 use the data.table package for data manipulation. You should not use any Tidyverse functions.

1. Emergency data (30%)

Use data.table functions to do the following.

  • Tabulate for each sex, the total number of individuals, the mean CRP, and the average 30-day mortality rate.
  • Tabulate for each sex and triage status, the total number of individuals, the mean CRP, and the average 30-day mortality rate.
  • Calculate the 30-day mortality risk ratio between males and females stratified by triage status.

2. League table (40%)

Using the EPL data and data.table functions, create the league table which contains for each team, the number of games played, the number of goals for, goals against, goal difference, and total points. Sort the table with the top point scorer on top.

2. Frog abnormalities (30%)

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.

Use data.table functions to do the following.

  • 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 table with a list of all sites, the proportion of abnormal frogs at each site, and the dissolved sodium concentration in water at each site.

4. (Optional)

Compare the timing of using data.table functions versus tidyverse functions for one or more of the tasks in this homework (you have used tidyverse it in previous homeworks).

5. Acknowledgements

Cite resources or individuals helping you.