Skip to content

Commit 9e3b51c

Browse files
authored
Export *compute_profile_ranking() as internal (#791)
* Export internal spa_compute_profile_ranking * Bump * Polish NEWS
1 parent c4ef750 commit 9e3b51c

8 files changed

+78
-43
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: tiltIndicator
22
Title: Indicators for the 'TILT' Project
3-
Version: 0.0.0.9223
3+
Version: 0.0.0.9224
44
Authors@R: c(
55
person("Mauro", "Lepore", , "[email protected]", role = c("aut", "cre"),
66
comment = c(ORCID = "https://orcid.org/0000-0002-1986-7988")),

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export(emissions_profile_any_compute_profile_ranking)
2020
export(emissions_profile_upstream)
2121
export(enquo)
2222
export(enquos)
23+
export(epa_compute_profile_ranking)
2324
export(example_companies)
2425
export(example_data_factory)
2526
export(example_dictionary)
@@ -46,6 +47,7 @@ export(sector_profile_any_polish_output_at_company_level)
4647
export(sector_profile_any_prepare_scenario)
4748
export(sector_profile_any_prune_companies)
4849
export(sector_profile_upstream)
50+
export(spa_compute_profile_ranking)
4951
export(summarize_range)
5052
export(tilt_profile)
5153
export(unnest_company)

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<!-- NEWS.md is maintained by https://cynkra.github.io/fledge, do not edit -->
22

3+
# tiltIndicator 0.0.0.9224 (2024-06-03)
4+
5+
* `spa_compute_profile_ranking()` and `spa_compute_profile_ranking()` is now
6+
exported as internal, and documented along with `epa_compute_profile_ranking()`
7+
under the topic `?spa_compute_profile_ranking` (#791).
8+
39
# tiltIndicator 0.0.0.9223 (2024-05-20)
410

511
* `sector_profile()` now accounts for unmatched `type`, `sector` or `subsector`

R/epa_compute_profile_ranking.R renamed to R/compute_profile_ranking.R

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,23 @@
1-
#' Add values to categorize
2-
#'
3-
#' @description
4-
#' `r lifecycle::badge("deprecated")`
5-
#'
6-
#' This function was deprecated because it's internal. Users don't need to
7-
#' interact with the function itself.
8-
#'
9-
#' @param data A "co2-like" data frame -- i.e. containing products or
10-
#' upstream-products (a.k.a. inputs).
1+
#' Compute profile ranking
112
#'
3+
#' @name compute_profile_ranking
124
#' @keywords internal
13-
#'
14-
#' @return The input data frame with the additional columns `grouped_by` and
15-
#' `profile_ranking` and one row per benchmark per company.
16-
#'
5+
NULL
6+
7+
#' @rdname compute_profile_ranking
178
#' @export
18-
#'
19-
#' @examples
20-
#' library(tiltToyData)
21-
#' library(readr, warn.conflicts = FALSE)
22-
#' options(readr.show_col_types = FALSE)
23-
#'
24-
#' companies <- read_csv(toy_emissions_profile_any_companies())
25-
#'
26-
#' products <- read_csv(toy_emissions_profile_products_ecoinvent())
27-
#' products |> emissions_profile_any_compute_profile_ranking()
28-
#'
29-
#' inputs <- read_csv(toy_emissions_profile_upstream_products_ecoinvent())
30-
#' inputs |> emissions_profile_any_compute_profile_ranking()
31-
emissions_profile_any_compute_profile_ranking <- function(data) {
32-
lifecycle::deprecate_warn(
33-
"0.0.0.9109",
34-
"emissions_profile_any_compute_profile_ranking()",
35-
details = "This function is now internal."
9+
#' @keywords internal
10+
spa_compute_profile_ranking <- function(data, scenarios) {
11+
left_join(
12+
data, scenarios,
13+
by = c(aka("scenario_type"), aka("xsector"), aka("xsubsector")),
14+
relationship = "many-to-many"
3615
)
37-
epa_compute_profile_ranking(data)
3816
}
3917

18+
#' @rdname compute_profile_ranking
19+
#' @export
20+
#' @keywords internal
4021
epa_compute_profile_ranking <- function(data) {
4122
check_epa_compute_profile_ranking(data)
4223

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#' Add values to categorize
2+
#'
3+
#' @description
4+
#' `r lifecycle::badge("deprecated")`
5+
#'
6+
#' This function was deprecated because it's internal. Users don't need to
7+
#' interact with the function itself.
8+
#'
9+
#' @param data A "co2-like" data frame -- i.e. containing products or
10+
#' upstream-products (a.k.a. inputs).
11+
#'
12+
#' @keywords internal
13+
#'
14+
#' @return The input data frame with the additional columns `grouped_by` and
15+
#' `profile_ranking` and one row per benchmark per company.
16+
#'
17+
#' @export
18+
#'
19+
#' @examples
20+
#' library(tiltToyData)
21+
#' library(readr, warn.conflicts = FALSE)
22+
#' options(readr.show_col_types = FALSE)
23+
#'
24+
#' companies <- read_csv(toy_emissions_profile_any_companies())
25+
#'
26+
#' products <- read_csv(toy_emissions_profile_products_ecoinvent())
27+
#' products |> emissions_profile_any_compute_profile_ranking()
28+
#'
29+
#' inputs <- read_csv(toy_emissions_profile_upstream_products_ecoinvent())
30+
#' inputs |> emissions_profile_any_compute_profile_ranking()
31+
emissions_profile_any_compute_profile_ranking <- function(data) {
32+
lifecycle::deprecate_warn(
33+
"0.0.0.9109",
34+
"emissions_profile_any_compute_profile_ranking()",
35+
details = "This function is now internal."
36+
)
37+
epa_compute_profile_ranking(data)
38+
}

R/spa.R

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@ prepare_scenarios <- function(data, low_threshold, high_threshold) {
4545
rename(profile_ranking = aka("co2reduce"))
4646
}
4747

48-
spa_compute_profile_ranking <- function(data, scenarios) {
49-
left_join(
50-
data, scenarios,
51-
by = c(aka("scenario_type"), aka("xsector"), aka("xsubsector")),
52-
relationship = "many-to-many"
53-
)
54-
}
55-
5648
spa_polish_output_at_product_level <- function(data) {
5749
data |>
5850
ungroup() |>

man/compute_profile_ranking.Rd

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

man/emissions_profile_any_compute_profile_ranking.Rd

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

0 commit comments

Comments
 (0)