Skip to content

Commit 83842f2

Browse files
authored
add examples and return value explanations to exported functions (#311)
1 parent 10e8774 commit 83842f2

10 files changed

+155
-44
lines changed

R/analyse.R

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,26 @@
33
#' @description
44
#' `analyse()` runs the necessary steps to analyse the matched loan books,
55
#' producing both the outputs of the standard PACTA analysis and the outputs of
6-
#' the net aggregated alignment metric, including tables and plots.
7-
#' Parameters for all steps are read from a `config.yml` file. The function is
8-
#' called for its side effects and writes the prepared and diagnosed data sets
9-
#' to the directory `output/analysis`, where `output` is the
10-
#' output directory specified in the `config.yml`.
6+
#' the net aggregated alignment metric, including tables and plots. Parameters
7+
#' for all steps are read from a `config.yml` file. The function is called for
8+
#' its side effects and writes the prepared and diagnosed data sets in the
9+
#' directory specified by `dir_analysis` in the `config.yml`.
1110
#'
1211
#' `analyse()` and `analyze()` are synonyms.
1312
#'
1413
#' @param config either a path to a config.yml file or a list of parameters
1514
#'
16-
#' @return NULL
15+
#' @return
16+
#'
17+
#' `analyse()` returns `NULL` invisibly. The function is called for its side
18+
#' effects and writes the prepared and diagnosed data sets in the directory
19+
#' specified by `dir_analysis` in the `config.yml`.
20+
#'
21+
#' @examples
22+
#' \dontrun{
23+
#' config <- "path/to/config.yml"
24+
#' analyse(config)
25+
#' }
1726
#'
1827
#' @export
1928

R/initialise_default_project.R

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
#' Initialise a project directory and its config file
22
#'
3+
#' @description
4+
#' `initialise_default_project()` sets up a default project directory, including
5+
#' a project directory, a default `config.yml` configuration file, an `input`
6+
#' sub-directory, and a `loanbooks` sub-directory.
7+
#'
38
#' @param path an absolute or relative path pointing to the location you would
49
#' like the project directory to be created
510
#'
6-
#' @returns NULL
11+
#' @return
12+
#'
13+
#' `initialise_default_project()` returns `NULL` invisibly. The function is
14+
#' called for its side effects of creating a default project directory at the
15+
#' specified path.
16+
#'
17+
#' @examples
18+
#' \dontrun{
19+
#' project_dir <- "path/to/project"
20+
#' initialise_default_project(project_dir)
21+
#' }
722
#'
823
#' @export
924

R/match_loanbooks.R

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,21 @@
99
#' processing. Parameters for the matching step are read from a `config.yml`
1010
#' file and follow the options available in `r2dii.match::match_name`. The
1111
#' function is called for its side effects and writes the prepared data sets to
12-
#' the directory `output/match`, where `output` is the output directory
13-
#' specified in the `config.yml`.
12+
#' the directory specified by `dir_matched_loanbooks` in the `config.yml`.
1413
#'
1514
#' @param config either a path to a config.yml file or a list of parameters
1615
#'
17-
#' @return NULL
16+
#' @return
17+
#'
18+
#' `match_loanbooks()` returns `NULL` invisibly. The function is called for its
19+
#' side effects and writes the prepared data sets to the directory specified by
20+
#' `dir_matched_loanbooks` in the `config.yml`.
21+
#'
22+
#' @examples
23+
#' \dontrun{
24+
#' config <- "path/to/config.yml"
25+
#' match_loanbooks(config)
26+
#' }
1827
#'
1928
#' @export
2029

R/prepare_abcd.R

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,24 @@
44
#' `prepare_abcd()` runs the necessary steps to prepare the input data sets for
55
#' the PACTA for Supervisors analysis. Specifically it prepares the abcd_final
66
#' data set by removing inactive companies if desired. And it allows preparing
7-
#' the ratios by which the exposures to counterparties are split along the sectors.
8-
#' Parameters for both steps are read from a `config.yml` file. The function is
9-
#' called for its side effects and writes the prepared data sets to the directory
10-
#' `output/prepare`, where `output` is the output directory specified in the
11-
#' `config.yml`.
7+
#' the ratios by which the exposures to counterparties are split along the
8+
#' sectors. Parameters for both steps are read from a `config.yml` file. The
9+
#' function is called for its side effects and writes the prepared data sets in
10+
#' the directory specified by `dir_prepared_abcd` in the `config.yml`.
1211
#'
1312
#' @param config either a path to a config.yml file or a list of parameters
1413
#'
15-
#' @return NULL
14+
#' @return
15+
#'
16+
#' `prepare_abcd()` returns `NULL` invisibly. The function is called for its
17+
#' side effects and writes the prepared data sets in the directory specified by
18+
#' `dir_prepared_abcd` in the `config.yml`.
19+
#'
20+
#' @examples
21+
#' \dontrun{
22+
#' config <- "path/to/config.yml"
23+
#' prepare_abcd(config)
24+
#' }
1625
#'
1726
#' @export
1827

R/prioritise_and_diagnose.R

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
#' Prioritise and diagnose the loan book data sets used in the PACTA for Supervisors analysis
22
#'
33
#' @description
4-
#' `prioritise_and_diagnose()` runs the necessary steps to prioritise the matched
5-
#' loan books and diagnose both the match success rate and the coverage of the
6-
#' real economy assets by the matched loan books.
7-
#' Parameters for all steps are read from a `config.yml` file. The function is
8-
#' called for its side effects and writes the prepared and diagnosed data sets
9-
#' to the directory `output/prioritise_and_diagnose`, where `output` is the
10-
#' output directory specified in the `config.yml`.
4+
#' `prioritise_and_diagnose()` runs the necessary steps to prioritise the
5+
#' matched loan books and diagnose both the match success rate and the coverage
6+
#' of the real economy assets by the matched loan books. Parameters for all
7+
#' steps are read from a `config.yml` file. The function is called for its side
8+
#' effects and writes the prepared and diagnosed data sets in the directory
9+
#' specified by `dir_prioritized_loanbooks_and_diagnostics` in the `config.yml`.
1110
#'
1211
#' `prioritise_and_diagnose()` and `prioritize_and_diagnose()` are synonyms.
1312
#'
1413
#' @param config either a path to a config.yml file or a list of parameters
1514
#'
16-
#' @return NULL
15+
#' @return
16+
#'
17+
#' `prioritise_and_diagnose()` returns `NULL` invisibly. The function is called
18+
#' for its side effects and writes the prepared and diagnosed data sets in the
19+
#' directory specified by `dir_prioritized_loanbooks_and_diagnostics` in the
20+
#' `config.yml`.
21+
#'
22+
#' @examples
23+
#' \dontrun{
24+
#' config <- "path/to/config.yml"
25+
#' prioritise_and_diagnose(config)
26+
#' }
1727
#'
1828
#' @export
1929

man/analyse.Rd

Lines changed: 16 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/initialise_default_project.Rd

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/match_loanbooks.Rd

Lines changed: 13 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/prepare_abcd.Rd

Lines changed: 16 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/prioritise_and_diagnose.Rd

Lines changed: 19 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)