Skip to content

Templating functions for "Building Tidy Tools 2022"

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

rstudio-conf-2022/btt22

Repository files navigation

btt22

R-CMD-check

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": day 2, session 1, task 1. 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 or tests/testthat folder.
    • btt_reset_hard(state): this is the “in case of emergency, break glass” function. According to the state, it rewrites your package’s :
      • R folder
      • tests/testthat folder
      • DESCRIPTION file: Imports and Suggests sections

Installation

You can install the development version of btt22 like so:

# install.packages("devtools")
devtools::install_github("rstudio-conf-2022/btt22")

Examples

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"?

About

Templating functions for "Building Tidy Tools 2022"

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages