Skip to content

Commit

Permalink
Export functions (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAxthelm authored Aug 15, 2024
1 parent b5a0edf commit becdd7e
Show file tree
Hide file tree
Showing 10 changed files with 216 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: workflow.pacta
Title: Run PACTA
Version: 0.0.0.9007
Version: 0.0.0.9008
Authors@R:
c(person(given = "CJ",
family = "Yetman",
Expand Down
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Generated by roxygen2: do not edit by hand

export(calc_weights_and_outputs)
export(run_analysis)
export(run_audit)
export(run_pacta)
importFrom(logger,log_debug)
importFrom(logger,log_error)
importFrom(logger,log_info)
Expand Down
23 changes: 23 additions & 0 deletions R/calc_weights_and_outputs.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
#' calc_weights_and_outputs
#'
#' @description This function calculates the weights and outputs for the
#' portfolio. This is the core of running the "PACTA analysis" for a portfolio.
#'
#' @param total_portfolio `data.frame`: PACTA formatted portfolio.
#' @param portfolio_type `character`: Portfolio type. Accepts "Equity" or
#' "Bonds".
#' @param output_dir filepath: Directory to save outputs.
#' @param data_dir filepath: Directory with "pacta-data"
#' @param equity_market_list character vector: List of equity markets to
#' include in analysis.
#' @param scenario_sources_list character vector: List of scenario sources to
#' include in analysis. Note sources must be available in the "pacta-data".
#' @param scenario_geographies_list character vector: List of scenario-defined
#' geographies to include in analysis. Note these geographies must be available
#' in the scenario data.
#' @param sector_list character vector: List of sectors to include in analysis.
#' @param start_year integer: Start year for analysis.
#' @param time_horizon integer: Time horizon after start for analysis (usually
#' 5 years).
#' @return No return value. Saves outputs to output_dir.
#' @export
calc_weights_and_outputs <- function(
total_portfolio,
portfolio_type,
Expand Down
19 changes: 19 additions & 0 deletions R/run_analysis.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
#' @title run_analysis
#'
#' @description This function runs the PACTA analysis for a portfolio.
#'
#' @param pacta_data_dir filepath: Directory with "pacta-data"
#' @param output_dir filepath: Directory to save outputs.
#' @param equity_market_list character vector: List of equity markets to
#' include in analysis.
#' @param scenario_sources_list character vector: List of scenario sources to
#' include in analysis. Note sources must be available in the "pacta-data".
#' @param scenario_geographies_list character vector: List of scenario-defined
#' geographies to include in analysis. Note these geographies must be available
#' in the scenario data.
#' @param sector_list character vector: List of sectors to include in analysis.
#' @param start_year integer: Start year for analysis.
#' @param time_horizon integer: Time horizon after start for analysis (usually
#' 5 years).
#' @return No return value. Saves outputs to output_dir.
#' @export
run_analysis <- function(
pacta_data_dir,
output_dir,
Expand Down
10 changes: 10 additions & 0 deletions R/run_audit.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
#' @title run_audit
#'
#' @description This function runs the PACTA audit for a portfolio.
#'
#' @param pacta_data_dir filepath: Directory with "pacta-data"
#' @param portfolio_dir filepath: Directory with portfolio files
#' @param portfolio_files character vector: List of portfolio files to process.
#' @param output_dir filepath: Directory to save outputs.
#' @return No return value. Saves outputs to output_dir.
#' @export
run_audit <- function(
pacta_data_dir,
portfolio_dir,
Expand Down
10 changes: 10 additions & 0 deletions R/run_pacta.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
#' @title Run PACTA
#'
#' @description This function runs the PACTA audit and analysis for a portfolio.
#'
#' @param raw_params character or filepath: JSON string or file with parameters.
#' @param pacta_data_dir filepath: Directory with "pacta-data"
#' @param output_dir filepath: Directory to save outputs.
#' @param portfolio_dir filepath: Directory with portfolio files
#' @return No return value. Saves outputs to output_dir.
#' @export
run_pacta <- function(
raw_params = commandArgs(trailingOnly = TRUE),
pacta_data_dir = Sys.getenv("PACTA_DATA_DIR"),
Expand Down
53 changes: 53 additions & 0 deletions man/calc_weights_and_outputs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions man/run_analysis.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions man/run_audit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions man/run_pacta.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit becdd7e

Please sign in to comment.