Description Usage Arguments Value Examples
This is a developer-facing function that helps create the pull request you
need to add a new sector-classification bridge to the package r2dii.data
(example). It
does create a commit but it does change your working tree: It adds new files
and modifies existing files. If the result is now what you want, you may
restore the last commit with something like git checkout . && git clean -i
.
Normally you would call this function from inside the project that contains
the source code of the package r2dii.data.
1 | use_bridge(dataset, data, contributor = NULL, issue = NULL, overwrite = FALSE)
|
dataset |
String. Name of the dataset. This is used as the "prefix" to
for an object-name of the form |
data |
A data frame. |
contributor |
String. Name of a contributor to thank in NEWS.md, e.g. "\@daisy-pacheco". |
issue |
String. Number of related issue or PR, e.g. #199. |
overwrite |
Logical. Allow overwriting data? |
This function is called for its side effects of adding and modifying files. It returns the first argument invisibly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ## Not run:
# Work form inside r2dii.data (here I use from a temporary copy)
old <- getwd()
r2dii_data <- file.path(tempdir(), "r2dii.data")
fs::dir_create(r2dii_data)
setwd(r2dii_data)
system("git clone https://github.com/2DegreesInvesting/r2dii.data.git -- .")
devtools::load_all()
library(r2dii.usethis)
# This is usually a contributed spreadsheet
dataset <- "fake"
data <- data.frame(
original_code = letters[1:3],
code_level = 5,
code = as.character(1:3),
sector = "not in scope",
borderline = FALSE
)
contributor <- "@somebody"
issue <- "#123"
use_bridge(dataset, data, contributor, issue)
# Notice what changed
system("git status -s")
# Teardown ----------------------------------------------------------------
unlink(r2dii_data, recursive = TRUE)
setwd(old)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.