Overview: REACH 2.0 data & analysis
Scaling
Empowering others (Voldemorts and Dumbledores)
Builder-User “contract”
Package Maintanance & Responsibility
User Testing
Validation and Processes
Curriculum
Version Control with git(hub) - ½ day
Exercise
- Set up a github account, install Git and Git(hub) and link it with RStudio
- Set up a public repository with a dummy file. Make at least 3 commits and 1 merge using at least 2 different branches.
- Send link to data unit for review
Software design (1 ½ days)
Exercise
- Write unit tests for a single (not yet existing) function (e.g. SMEB calculation)
- Write a pure function that passes the tests
- Push to github and send link to Data Unit for code review & Q&A
Writing Packages in R (2 days)
(this generally follows Hadley Wickham’s book on creating R packages)
Getting started
Exercise
- Set up an R package project and push to github. Send link to data unit for review
Package components
Exercise
- Adjust your pure function according to the reading
- Add the function to the package project you created earlier according to the reading
- Add your unit tests to the package according to the reading
- push to github for data unit review
Documentation
Exercise
- Add roxygen comments to all package functions
- It should have at least:
- Consise title and description
@param for all function parameters. Be precise on the format of the input (what data structure and data type does the function expect). Clarify the default behaviour.
@details concise description of the methodology; default behaviour; any unexpected behaviour; limitations/things to watch out for
@value what does the function return, and in what format?
@examples at least one self contained example
@export for all user facing functions
- Add at least one Vignette with a basic example on a fake data frame. It should contain at least
- Summary
- what problem does the package solve
- When should your package be used? When should it not be used / limitations?
- Quickstart
- the minimum the user needs to know to use the package to solve the problem. Give a working example
- Details
- Additional features: Expand from the quickstart example all other functionality that wasn’t covered in the quickstart guide
- Methodology: Any details about the package behaviour that isn’t obvious
- Push everything to github for the data unit to test. The package should now be fully functional and transparently documented.
Certification Requirements
- A simple R package
- Write a package for a single, simple task to solve a task that you or someone in your team does on a regular basis. It is ok if the package contains only a single user facing function.
- Scope Requirements
- The package is up on github and works out of the box
- All functions are well documented with roxygen2 function manuals (I can use ?packagename::functionname and get all the information I need to use your packages functions.
- A clear manual is available via BrowseVignettes(packagename)
- All functions are pure (exceptions are functions that are explicitely meant to read or write files; functions are still pure if they use other functions, as long as those functions are pure)
- The package functions work with any data (they are independent from variable names etc.)
- The code is readable and easy to understand
- Best practices outlined in the curriculum are followed