ETC5523: Communicating with Data

Tutorial 10

Author

Michael Lydeamore

Published

1 November 2001

🎯 Objectives

  • practice writing long-form documentation vignettes
  • write functions and its documentation using usethis and roxygen2
  • convert your package documentation into a website with pkgdown
  1. install.packages(c("pkgdown"))
  2. Clone the github repo below:
git clone git@github.com:MikeLydeamore/solardash.git

Exercise 9A

Open the solardash project directory and create a new vignette via usethis.

The name of the vignette should be “crops” and the title will be “Our World in Data: Key Crop Yields”.

Your vignette should contain the following:

  • A description of the data, including it’s source, and how to access it with your package.
  • Two ggplot2 visualisations with short descriptions, giving examples of things you could learn from the smartmeter data. Remember that any external packages you use should be added to your DESCRIPTION file under Suggests.

Once you have finished your vignette, create a README file via usethis that describes the intent of the package and how you could install it from your github.

Exercise 9B

Build a local pkgdown website. Modify the pkgdown YAML file so your website has the following:

  • a customised theme for the website
  • the vignette is available via “Articles” link in the navbar

Exercise 9C

Inspect the inst directory. What do you see in there?

How is that code being used in the package?

Write a new shiny app, based on the one in inst, that converts the current ggplot to a plotly output. Then, write a new function for the package that will run this app.