R pkg dev
| Command | Comment | Shortcut |
|---|---|---|
devtools::check() |
build and check the pkg | Cmd + Shift + E |
devtools::load_all() |
load the pkg | Cmd + Shift + L |
devtools::document() |
document the pkg | Cmd + Shift + D |
pak::local_install(upgrade = FALSE) |
install the pkg into the first library of .libPaths()
|
Cmd + Shift + B |
conda
| Command | Comment |
|---|---|
conda install foo -c bar |
install pkg foo from channel bar
|
conda create --file env.yml --prefix ./bar |
install conda pkgs listed in env.yml into the ./bar directory |
conda info -e |
list conda environments installed on this machine |
rattler-build build -r recipe.yaml --output-dir ${HOME}/tmp |
build conda pkg from a recipe file |
rattler-build upload anaconda -o tidywf --api-key <xxx> ${HOME}/tmp/r-<pkg>.conda |
upload conda pkg to anaconda |
pkgdown
| Command | Comment |
|---|---|
pkgdown::build_site() |
builds entire site |
pkgdown::build_articles(quiet = FALSE) |
builds vignettes in debug mode |
pkgdown::build_article("foo") |
builds foo vignette only |
Debugging R6 private methods
For private methods, reach into .__enclos_env__$private (flags that instance only):
devtools::load_all()
path <- system.file("extdata/tool1", package = "nemo")
t <- Tool$new(name = "tool1", pkg = "nemo", path = path)
debugonce(t$.__enclos_env__$private$build_d_write)
t$run(output_dir = tempdir(), format = "parquet") # breaks on first callCall private methods standalone:
Data Version Control
DVC keeps test/example data in remote storage, tracked in git. Run dvc pull before tests, examples or vignettes.
Each pkg has two Cloudflare R2 remotes:
- pull:
cloudflare_r2_<pkg>(public, no auth), the default in.dvc/config - push:
cloudflare_r2_<pkg>_push(private), set in gitignored.dvc/config.local, with R2 creds passed via env vars
| Command | Comments |
|---|---|
dvc init |
initialise dvc |
dvc remote add -d storage gdrive://<...> |
add GDrive remote |
dvc remote add -d my_r2 s3://<...> |
add Cloudflare R2 remote |
dvc remote modify my_r2 endpointurl https://<...>.r2.cloudflarestorage.com |
add Cloudflare R2 remote endpointurl |
dvc remote list |
list all remotes |
dvc check-ignore * |
check what is dvc-ignored |
dvc list https://github.com/tidywf/<pkg> inst/extdata |
list dvc’ed data |
dvc add path/to/folder |
adds folder (and its contents) to dvc |
dvc add path/to/file.txt |
adds file.txt to dvc |
dvc pull |
pulls dvc data from public remote (no auth) |
AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... dvc push -r cloudflare_r2_<pkg>_push |
pushes dvc data to private R2 remote (needs auth) |
