From 0059ead2f6a89735c82f28342490ce5d6fccc9bb Mon Sep 17 00:00:00 2001 From: Kalash Singhal <125359076+kalashsinghal@users.noreply.github.com> Date: Fri, 14 Jun 2024 12:56:29 +0200 Subject: [PATCH] Export `epa_at_company_level()` and `insert_row_with_na_in_risk_category()` (#795) * export epa_at_company_level * export insert_row_with_na_in_risk_category --- NAMESPACE | 2 ++ R/emissions_profile.R | 8 ++++++++ R/epa_at_company_level.R | 7 +++++++ man/epa_at_company_level.Rd | 18 ++++++++++++++++++ man/insert_row_with_na_in_risk_category.Rd | 18 ++++++++++++++++++ 5 files changed, 53 insertions(+) create mode 100644 man/epa_at_company_level.Rd create mode 100644 man/insert_row_with_na_in_risk_category.Rd diff --git a/NAMESPACE b/NAMESPACE index 73f7c34b2..0972bfed5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -21,6 +21,7 @@ export(emissions_profile_any_compute_profile_ranking) export(emissions_profile_upstream) export(enquo) export(enquos) +export(epa_at_company_level) export(epa_compute_profile_ranking) export(example_companies) export(example_data_factory) @@ -30,6 +31,7 @@ export(example_raw_ipr) export(example_raw_weo) export(exclude) export(extdata_path) +export(insert_row_with_na_in_risk_category) export(is_tilt_profile) export(istr) export(istr_at_company_level) diff --git a/R/emissions_profile.R b/R/emissions_profile.R index f08ba6caa..b0e3eb6c0 100644 --- a/R/emissions_profile.R +++ b/R/emissions_profile.R @@ -31,6 +31,14 @@ emissions_profile <- function(companies, #' @rdname emissions_profile_upstream emissions_profile_upstream <- emissions_profile + +#' Insert row with NA in risk category +#' +#' @param data A dataframe +#' +#' @return A dataframe +#' @export +#' @keywords internal insert_row_with_na_in_risk_category <- function(data) { levels <- c(risk_category_levels(), NA) data |> diff --git a/R/epa_at_company_level.R b/R/epa_at_company_level.R index a65baa8d5..0429aabc5 100644 --- a/R/epa_at_company_level.R +++ b/R/epa_at_company_level.R @@ -1,3 +1,10 @@ +#' Calculate indicator's profile output at company level +#' +#' @param data A dataframe +#' +#' @return A dataframe +#' @export +#' @keywords internal epa_at_company_level <- function(data) { count_of_na <- data |> select(all_of(cols_at_all_levels())) |> diff --git a/man/epa_at_company_level.Rd b/man/epa_at_company_level.Rd new file mode 100644 index 000000000..8fcdc24bd --- /dev/null +++ b/man/epa_at_company_level.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/epa_at_company_level.R +\name{epa_at_company_level} +\alias{epa_at_company_level} +\title{Calculate indicator's profile output at company level} +\usage{ +epa_at_company_level(data) +} +\arguments{ +\item{data}{A dataframe} +} +\value{ +A dataframe +} +\description{ +Calculate indicator's profile output at company level +} +\keyword{internal} diff --git a/man/insert_row_with_na_in_risk_category.Rd b/man/insert_row_with_na_in_risk_category.Rd new file mode 100644 index 000000000..7082977a8 --- /dev/null +++ b/man/insert_row_with_na_in_risk_category.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/emissions_profile.R +\name{insert_row_with_na_in_risk_category} +\alias{insert_row_with_na_in_risk_category} +\title{Insert row with NA in risk category} +\usage{ +insert_row_with_na_in_risk_category(data) +} +\arguments{ +\item{data}{A dataframe} +} +\value{ +A dataframe +} +\description{ +Insert row with NA in risk category +} +\keyword{internal}