Package 'pacta.portfolio.utils'

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

Help Index


Check if a file exists and abort with a message if not

Description

Check if a file exists and abort with a message if not

Usage

abort_if_file_doesnt_exist(path)

Arguments

path

A string containing the path to the file to be checked for

Value

Returns the path (a string) invisibly


A short description of the function

Description

A longer description of the function

Usage

create_portfolio_subfolders(
  portfolio_name_ref_all = NULL,
  project_location = NULL
)

Arguments

portfolio_name_ref_all

A description of the argument

project_location

A description of the argument

Value

A description of the return value


Checks whether a variable is a data frame

Description

Checks whether a variable is a data frame. Considers also logicals and null values.

Usage

data_check(df)

Arguments

df

A description of the argument

Value

A logical: TRUE if df is a data frame and has 1 or more rows, otherwise FALSE


A short description of the function

Description

A longer description of the function

Usage

empty_audit_file()

Value

A description of the return value


A short description of the function

Description

A longer description of the function

Usage

empty_company_results()

Value

A description of the return value


A short description of the function

Description

A longer description of the function

Usage

empty_emissions_results()

Value

A description of the return value


A short description of the function

Description

A longer description of the function

Usage

empty_map_results()

Value

A description of the return value


A short description of the function

Description

A longer description of the function

Usage

empty_portfolio_overview()

Value

A description of the return value


A short description of the function

Description

A longer description of the function

Usage

empty_portfolio_results()

Value

A description of the return value


A short description of the function

Description

A longer description of the function

Usage

get_build_version_msg()

Value

A description of the return value


Log user errors

Description

Log user errors

Usage

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
)

Arguments

error_name

A parameter

suggested_action

A parameter

description

A parameter

error_file

A parameter

immediate

A parameter

Value

Return value


A short description of the function

Description

A longer description of the function

Usage

quit_if_no_pacta_relevant_data(portfolio)

Arguments

portfolio

A description of the argument

Value

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.

Description

Return the object stored in a RDS at a specified file path, or an alternate value/object if the file doesn't exist.

Usage

readRDS_or_return_alt_data(filepath, alt_return = NULL)

Arguments

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 filepath does not exist

Value

an object, either the object stored in the RDS at the filepath or the value of alt_return


A short description of the function

Description

A longer description of the function

Usage

remove_if_exists(obj)

Arguments

obj

A description of the argument

Value

A description of the return value

Examples

obj <- 1L
exists("obj")
remove_if_exists(obj)
exists("obj")

exists("obj2")
remove_if_exists(obj2)

A short description of the function

Description

A longer description of the function

Usage

save_if_exists(df, portfolio_name, save_name, csv_or_rds = "rds")

Arguments

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

Value

A description of the return value


A short description of the function

Description

A longer description of the function

Usage

set_analysis_inputs_path(data_location_ext)

Arguments

data_location_ext

A description of the argument

Value

A description of the return value


A short description of the function

Description

A longer description of the function

Usage

set_portfolio_parameters(file_path)

Arguments

file_path

A description of the argument

Value

A description of the return value


A short description of the function

Description

A longer description of the function

Usage

set_project_parameters(file_path)

Arguments

file_path

A description of the argument

Value

A description of the return value


A short description of the function

Description

A longer description of the function

Usage

set_webtool_paths(project_root_dir = "working_dir")

Arguments

project_root_dir

A description of the argument

Value

A description of the return value


A short description of the function

Description

A longer description of the function

Usage

setup_project()

Value

A description of the return value


Write log

Description

Write log

Usage

write_log(msg, file_path = .GlobalEnv$log_path, ...)

Arguments

msg

A parameter

file_path

A parameter

...

Additional parameters

Value

Return value