Purpose: To test your fundamental R package development skills.
Pre-requisites: Required: R Programming I
The following instructions describe the requirements to complete this task and earn the R Programming II badge 🏆. They also provide guidance to help you along the way.
A few things to keep in mind:
- Please remember at all times to abide by the BRN Code of Conduct and Academic Honesty Policy. If you notice violations of these policies, please contact [email protected].
- Please remember to reach out if you get stuck, find bugs, or even just have a question!
Good luck and have fun! 😊
~ BRN Bot 🤖
Badge Requirements:
Testing environment:
Assessment Premise:
TLDR; Take the functions from R Programming I and turn them into a package called "BioUtils"
After you completed the tasks your supervisor gave you in R Programming I, you get a call from HR. Apparently, your functions were so useful that you have been promoted from a Bioinformatics Assistant to Bioinformatics Associate 🚀. Your first task will be to turn your utils.R
script into a package, BioUtils
, for the whole bioinformatics team to use 🎯. The package should contain all the functions you wrote in utils.R
, but properly formatted as an R package and well-documented. This will enable your colleagues to easily install your package and use the functions contained within!
Users will use your package like so:
library(BioUtils)
cancer <- "ATCGCATACGA"
normal <- "ATCCCAGATGA"
protein_variant(cancer, normal)
Prior to releasing the package, your new supervisor will make sure that everything works correctly and that it is well-formatted/documented. She will deploy a bot to run automated checks on your package -- they should produce no errors, warnings, or notes.
Automated checks
The bot will initiate an R v4.2.0
session and install BioUtils
package by running:
devtools::build()
Then it will test the package by running:
devtools::test()
Next, it will run CRAN checks:
devtools::check(cran = TRUE, error_on="note")
Next, it will check the style of the package using lintr
from the linux command line:
Rscript -e "errors <- lintr::lint_package(); print(errors); quit(save = 'no', status = length(errors))"
Most guidance for this assessment is identical to R Programming I, with the following additions:
Due to naming conventions in R packages, it is a very good idea to clone this github repository with the name BioUtils
specified for the output directory:
git clone <link_to_repo> BioUtils
To learn about building and documenting R packages, visit the following link: R packages book
The easiest way to complete this assignment is to make heavy usage of the usethis
R package: link. For example, it is strongly recommended to begin this task by running usethis::create_package()
. When adding new datasets to the package, it is recommended to run usethis::use_data_raw()
to initialize them.
If you find a bug or get confused, please don't hesitate to contact the BRN Skill Assessment maintainers on the #help-skill-assessments Slack channel, and they will assist you.