| Title: | pacta.portfolio.utils |
|---|---|
| Description: | For more information visit <https://rmi.org/>. |
| Authors: | CJ Yetman [aut, cre, ctr] (ORCID: <https://orcid.org/0000-0001-5099-9500>), Jackson Hoffart [aut, ctr] (ORCID: <https://orcid.org/0000-0002-8600-5042>), Jacob Kastl [aut, ctr], Alex Axthelm [aut, ctr] (ORCID: <https://orcid.org/0000-0001-8579-8565>), RMI [cph, fnd] |
| Maintainer: | CJ Yetman <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.2.9000 |
| Built: | 2026-05-24 07:18:55 UTC |
| Source: | https://github.com/rmi-pacta/pacta.portfolio.utils |
Check if a file exists and abort with a message if not
abort_if_file_doesnt_exist(path)abort_if_file_doesnt_exist(path)
path |
A string containing the path to the file to be checked for |
Returns the path (a string) invisibly
A longer description of the function
create_portfolio_subfolders( portfolio_name_ref_all = NULL, project_location = NULL )create_portfolio_subfolders( portfolio_name_ref_all = NULL, project_location = NULL )
portfolio_name_ref_all |
A description of the argument |
project_location |
A description of the argument |
A description of the return value
Checks whether a variable is a data frame. Considers also logicals and null values.
data_check(df)data_check(df)
df |
A description of the argument |
A logical: TRUE if df is a data frame and has 1 or more rows, otherwise FALSE
A longer description of the function
empty_audit_file()empty_audit_file()
A description of the return value
A longer description of the function
empty_company_results()empty_company_results()
A description of the return value
A longer description of the function
empty_emissions_results()empty_emissions_results()
A description of the return value
A longer description of the function
empty_map_results()empty_map_results()
A description of the return value
A longer description of the function
empty_portfolio_overview()empty_portfolio_overview()
A description of the return value
A longer description of the function
empty_portfolio_results()empty_portfolio_results()
A description of the return value
A longer description of the function
get_build_version_msg()get_build_version_msg()
A description of the return value
Log user errors
log_user_errors( error_name, suggested_action = "", description = "", error_file = file.path(.GlobalEnv$outputs_path, .GlobalEnv$portfolio_name_ref_all, "report", "user_errors.json"), immediate = FALSE )log_user_errors( error_name, suggested_action = "", description = "", error_file = file.path(.GlobalEnv$outputs_path, .GlobalEnv$portfolio_name_ref_all, "report", "user_errors.json"), immediate = FALSE )
error_name |
A parameter |
suggested_action |
A parameter |
description |
A parameter |
error_file |
A parameter |
immediate |
A parameter |
Return value
A longer description of the function
quit_if_no_pacta_relevant_data(portfolio)quit_if_no_pacta_relevant_data(portfolio)
portfolio |
A description of the argument |
A description of the return value
Return the object stored in a RDS at a specified file path, or an alternate value/object if the file doesn't exist.
readRDS_or_return_alt_data(filepath, alt_return = NULL)readRDS_or_return_alt_data(filepath, alt_return = NULL)
filepath |
a single string containing a file path to a RDS file |
alt_return |
an R object/value to be returned if the file at |
an object, either the object stored in the RDS at the filepath or
the value of alt_return
A longer description of the function
remove_if_exists(obj)remove_if_exists(obj)
obj |
A description of the argument |
A description of the return value
obj <- 1L exists("obj") remove_if_exists(obj) exists("obj") exists("obj2") remove_if_exists(obj2)obj <- 1L exists("obj") remove_if_exists(obj) exists("obj") exists("obj2") remove_if_exists(obj2)
A longer description of the function
save_if_exists(df, portfolio_name, save_name, csv_or_rds = "rds")save_if_exists(df, portfolio_name, save_name, csv_or_rds = "rds")
df |
A description of the argument |
portfolio_name |
A description of the argument |
save_name |
A description of the argument |
csv_or_rds |
A description of the argument |
A description of the return value
A longer description of the function
set_analysis_inputs_path(data_location_ext)set_analysis_inputs_path(data_location_ext)
data_location_ext |
A description of the argument |
A description of the return value
A longer description of the function
set_portfolio_parameters(file_path)set_portfolio_parameters(file_path)
file_path |
A description of the argument |
A description of the return value
A longer description of the function
set_project_parameters(file_path)set_project_parameters(file_path)
file_path |
A description of the argument |
A description of the return value
A longer description of the function
set_webtool_paths(project_root_dir = "working_dir")set_webtool_paths(project_root_dir = "working_dir")
project_root_dir |
A description of the argument |
A description of the return value
A longer description of the function
setup_project()setup_project()
A description of the return value
Write log
write_log(msg, file_path = .GlobalEnv$log_path, ...)write_log(msg, file_path = .GlobalEnv$log_path, ...)
msg |
A parameter |
file_path |
A parameter |
... |
Additional parameters |
Return value