-
Notifications
You must be signed in to change notification settings - Fork 1
2.1: Design
Ian Lyttle edited this page Jun 11, 2022
·
1 revision
This is a way for Ian to keep track of the states for day 2 of the workshop.
For Ian's purposes a state refers to:
- files in the
R
directory - files in the
tests/testthat
directory - the
Imports
andSuggests
entries in theDESCRIPTION
file
These files, 👆, can be summoned using btt22::btt_reset()
, but hopefully no-one will need to do so.
A state also refers to a set of files that will be templated into the R
and tests/testthat
directories; you can use btt22::btt_get()
to get these files.
Both of these functions take a single argument, state
. You can get the available states using btt22::btt_state()
.
This is the initial state for the functions day.
We have two files in R
:
Files:
R/ussie_package.R
R/matches.R
tests/testthat/test-matches.R
In DESCRIPTION
:
Imports:
dplyr,
tibble
Suggests:
engsoccerdata,
conflicted,
knitr,
rmarkdown,
roxygen2,
testthat (>= 3.0.0)
usethis::use_package("rlang")
usethis::use_import_from("rlang", ".data")
- add
.data
pronoun, as needed, touss_get_matches()
inmatches.R
R CMD CHECK
will be happy.
We have some files to be templated in:
R/columns.R
R/get-matches.R
tests/testthat/test-get-matches.R
-
usethis::use_package("engsoccerdata")
(import rather than suggest) - run
devtools::check()
, we get aNOTE
-
btt22::btt_get("2.1.2")
, see thatdevtools::check()
is almost happy (🤔: using R 4.2.0, I don't get a note) -
usethis::use_package("utils")
(maybe this is not necessary, see 👆) - see that
devtools::check()
is happy (maybe this is not necessary, see 👆) - go through new code, why we have to use these tricks
- exercise:
- use function from
columns.R
intest-matches.R
- write up
uss_countries()
anduss_get_matches()
in vignette
- we have two new functions:
uss_countries()
anduss_get_matches()
. -
R CMD CHECK
will be happy.