The goal of btt22 is to help you build the ussie package during the Building Tidy Tools 2022 workshop.
The central project for this course is that each student will build a package called {ussie}, and populate it with functions.
There are two big purposes for this package:
- if you install this package, you will have all the packages you need for this course.
- you can use the functions from this package to import code:
btt_state()
: list all the available states. A state has an identifier like"2.1.1"
: day2
, session1
, task1
. This identifier corresponds to a branch in the {ussie} repository.btt_get(state)
:- gets the skeleton code to be used for the given
state
- puts it into your package’s
R
folder ortests/testthat
folder.
- gets the skeleton code to be used for the given
btt_reset_hard(state)
: this is the “in case of emergency, break glass” function. According to thestate
, it rewrites your package’s :R
foldertests/testthat
folderDESCRIPTION
file:Imports
andSuggests
sections
You can install the development version of btt22 like so:
# install.packages("devtools")
devtools::install_github("rstudio-conf-2022/btt22")
Here’s how to get the available states:
library(btt22)
btt_state()
#> [1] "2.1.1" "2.1.2" "2.2.1" "2.2.2" "2.2.3" "2.3.1" "2.3.2" "2.3.3" "2.3.4"
#> [10] "2.3.5" "2.3.6" "2.3.7" "2.4.1" "2.4.2" "2.4.3"
Let’s say we are at the start of the second session of day 2 - this
corresponds to state "2.2.1"
.
Let’s say that you, dear student, are on the happy path. In this case, to get the templated code for this task, you would:
btt_get("2.2.1")
Let’s say that you are not on the happy path and that the best course of action is just to catch-up. In this case, to get the completed code, you would:
btt_reset_hard("2.2.1")
Then you could use btt_get("2.2.1")
to get the templated code beacuse
you would now be on the the happy path.
To avoid inadvertent chaos, btt_get()
and btt_reset_hard()
make a
couple of checks before it writes anything to your project:
- is your working directory in a package?
- is this package called
"ussie"
?