Lab 3 - Making a package

Lab organization

  1. In Canvas, look up on which team you are.

  2. As last time, there is a github classroom link. Select the invite with your team’s number (or create a team in case there is none yet).

  3. Hofmann, don’t forget the Zoom breakout rooms. Join the room that matches your team number.

  4. Final deliverable: submit a link to your repository in Canvas (This will show me that you are done working on your project).

  5. Our goal for today: create an R package!

Make sure to talk!

All team members are supposed to contribute … last time you might have realized that it is a pretty big mess if everybody writes into the README file all at the same time.

This time: figure out a plan before you start working. Include your plan as a table in the README.Rmd file for lab #3.

Our Goal for this lab

  • create an R package …

  • … based on the code from last time …

  • … and make sure that the package passes R CMD check

Repo for the lab

  1. Accept the link to the github classroom assignment (sent by email).

  2. Check whether one of your team members has already created a team. In that case, join them. If none of your team members is listed yet, create a team.

  3. Link the repository to RStudio …

Package specifications: Functions

The package should contain a set of functions (see Lab 2 sample code):

  • get_pd_presslog (url, save_as)
    this function is supposed to download the current ames pd presslog and save a copy to a specified location

  • pdf_to_tbl (pdf, save_as) takes as input a (path to a pdf) presslog from Ames PD and returns a tibble. If save_as is specified, it also saves a copy of the result as csv file to a local file.

  • get_presslog (from, to) takes as input two dates/times and returns all (available) service calls made to the Ames PD during the specified time frame.

You could think about setting defaults, such as

  • url = "https://data.city.ames.ia.us/publicinformation/PressLog.pdf" or
  • save_as = sprintf("presslog_amespd_%s.pdf", lubridate::today())

Package specifications: Data

Include a data set called presslog_ames in the package, that contains all available data on service calls to the Ames PD based on presslogs available from Lab 2.

Make sure to document the data and include an example use case.

Does the package pass the tests?

Run command check locally (under Build > Check) to if the package still passes.
There should be no errors, warnings, or notes.

0 errors ✔️ | 0 warnings ✔️ | 0 notes ✔️

R CMD check succeeded

Make sure to give your team a lot of time to hunt down these problems.