Skip to content

Commit

Permalink
Style (manual): don't end lines in assignment operator
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAxthelm committed Dec 18, 2024
1 parent ddf02e6 commit 3cbf404
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 125 deletions.
31 changes: 12 additions & 19 deletions R/prep_audit_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ prep_audit_table <- function(
currency_exchange_value
) {

audit_table_init <-
audit_file |>
audit_table_init <- audit_file |>
dplyr::filter(
.data[["investor_name"]] == .env[["investor_name"]],
.data[["portfolio_name"]] == .env[["portfolio_name"]]
Expand Down Expand Up @@ -56,8 +55,7 @@ prep_audit_table <- function(
value_usd = .data[["value_usd"]] / .env[["currency_exchange_value"]]
)

Check warning on line 56 in R/prep_audit_table.R

View check run for this annotation

Codecov / codecov/patch

R/prep_audit_table.R#L52-L56

Added lines #L52 - L56 were not covered by tests

included_table_totals <-
audit_table_init |>
included_table_totals <- audit_table_init |>
dplyr::group_by(.data[["asset_type_analysis"]], .data[["included"]]) |>
dplyr::summarise(
total_value_invested = sum(.data[["value_usd"]], na.rm = TRUE),
Expand All @@ -69,8 +67,7 @@ prep_audit_table <- function(
)
)

Check warning on line 68 in R/prep_audit_table.R

View check run for this annotation

Codecov / codecov/patch

R/prep_audit_table.R#L68

Added line #L68 was not covered by tests

included_table_value_breakdown <-
audit_table_init |>
included_table_value_breakdown <- audit_table_init |>
dplyr::mutate(
investment_means = dplyr::case_when(
(
Expand All @@ -89,16 +86,14 @@ prep_audit_table <- function(
.groups = "drop"
)

Check warning on line 87 in R/prep_audit_table.R

View check run for this annotation

Codecov / codecov/patch

R/prep_audit_table.R#L79-L87

Added lines #L79 - L87 were not covered by tests

fields_totals <-
c(
"asset_type_analysis",
"included",
"total_value_invested",
"percentage_value_invested"
)
fields_totals <- c(
"asset_type_analysis",
"included",
"total_value_invested",
"percentage_value_invested"
)

Check warning on line 94 in R/prep_audit_table.R

View check run for this annotation

Codecov / codecov/patch

R/prep_audit_table.R#L89-L94

Added lines #L89 - L94 were not covered by tests

included_table_per_asset <-
included_table_totals |>
included_table_per_asset <- included_table_totals |>
dplyr::left_join(
included_table_value_breakdown,
by = dplyr::join_by("asset_type_analysis")
Expand All @@ -113,8 +108,7 @@ prep_audit_table <- function(
"investment_means"
)

Check warning on line 109 in R/prep_audit_table.R

View check run for this annotation

Codecov / codecov/patch

R/prep_audit_table.R#L96-L109

Added lines #L96 - L109 were not covered by tests

sum_table <-
included_table_per_asset |>
sum_table <- included_table_per_asset |>
dplyr::summarise(
asset_type_analysis = "Total",
total_value_invested = sum(.data[["total_value_invested"]], na.rm = TRUE),
Expand Down Expand Up @@ -153,8 +147,7 @@ remove_dupe_entries_totals <- function(
fields_totals
) {
for (asset in unique(table[["asset_type_analysis"]])) {
idx_asset <-
table |>
idx_asset <- table |>
dplyr::mutate(
is_chosen_asset = .data[["asset_type_analysis"]] == .env[["asset"]]
) |>
Expand Down
6 changes: 2 additions & 4 deletions R/prep_company_bubble.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ prep_company_bubble <- function(
green_techs
) {

equity_data <-
equity_results_company |>
equity_data <- equity_results_company |>
dplyr::filter(.data[["portfolio_name"]] == .env[["portfolio_name"]]) |>
dplyr::filter(.data[["ald_sector"]] %in% c("Power", "Automotive")) |>
dplyr::filter(.data[["equity_market"]] == "GlobalMarket") |>
Expand Down Expand Up @@ -73,8 +72,7 @@ prep_company_bubble <- function(
dplyr::mutate(y = pmax(.data[["y"]], 0L, na.rm = TRUE)) |>
dplyr::mutate(asset_class = "Listed Equity")

Check warning on line 73 in R/prep_company_bubble.R

View check run for this annotation

Codecov / codecov/patch

R/prep_company_bubble.R#L12-L73

Added lines #L12 - L73 were not covered by tests

bonds_data <-
bonds_results_company |>
bonds_data <- bonds_results_company |>
dplyr::filter(.data[["portfolio_name"]] == .env[["portfolio_name"]]) |>
dplyr::filter(.data[["ald_sector"]] %in% c("Power", "Automotive")) |>
dplyr::filter(.data[["equity_market"]] == "GlobalMarket") |>
Expand Down
19 changes: 9 additions & 10 deletions R/prep_emissions_trajectory.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ prep_emissions_trajectory <- function(
year_span,
start_year
) {
emissions_units <-
c(
Automotive = "tons of CO\U00002082 per km per cars produced",
Aviation = "tons of CO\U00002082 per passenger km per active planes",
Cement = "tons of CO\U00002082 per tons of cement",
Coal = "tons of CO\U00002082 per tons of coal",
`Oil&Gas` = "tons of CO\U00002082 per GJ",
Power = "tons of CO\U00002082 per MWh",
Steel = "tons of CO\U00002082 per tons of steel"
)
emissions_units <- c(
Automotive = "tons of CO\U00002082 per km per cars produced",
Aviation = "tons of CO\U00002082 per passenger km per active planes",
Cement = "tons of CO\U00002082 per tons of cement",
Coal = "tons of CO\U00002082 per tons of coal",
`Oil&Gas` = "tons of CO\U00002082 per GJ",
Power = "tons of CO\U00002082 per MWh",
Steel = "tons of CO\U00002082 per tons of steel"
)

Check warning on line 17 in R/prep_emissions_trajectory.R

View check run for this annotation

Codecov / codecov/patch

R/prep_emissions_trajectory.R#L9-L17

Added lines #L9 - L17 were not covered by tests

list(
`Listed Equity` = equity_results_portfolio,
Expand Down
6 changes: 2 additions & 4 deletions R/prep_key_bars_company.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ prep_key_bars_company <- function(
all_tech_levels
) {

equity_data_company <-
equity_results_company |>
equity_data_company <- equity_results_company |>
dplyr::filter(.data[["portfolio_name"]] == .env[["portfolio_name"]]) |>
dplyr::filter(.data[["year"]] %in% c(.env[["start_year"]] + 5L)) |>
dplyr::filter(.data[["equity_market"]] %in% c("Global", "GlobalMarket")) |>
Expand Down Expand Up @@ -40,8 +39,7 @@ prep_key_bars_company <- function(
dplyr::filter(!is.null(.data[["port_weight"]])) |>
dplyr::filter(!is.null(.data[["plan_tech_share"]]))

Check warning on line 40 in R/prep_key_bars_company.R

View check run for this annotation

Codecov / codecov/patch

R/prep_key_bars_company.R#L14-L40

Added lines #L14 - L40 were not covered by tests

bonds_data_company <-
bonds_results_company |>
bonds_data_company <- bonds_results_company |>
dplyr::filter(.data[["portfolio_name"]] == .env[["portfolio_name"]]) |>
dplyr::filter(.data[["year"]] %in% c(.env[["start_year"]] + 5L)) |>
dplyr::filter(.data[["equity_market"]] %in% c("Global", "GlobalMarket")) |>
Expand Down
6 changes: 2 additions & 4 deletions R/prep_key_bars_portfolio.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ prep_key_bars_portfolio <- function(
pacta_sectors_not_analysed,
all_tech_levels
) {
equity_data_portfolio <-
equity_results_portfolio |>
equity_data_portfolio <- equity_results_portfolio |>
dplyr::filter(.data[["portfolio_name"]] == .env[["portfolio_name"]]) |>
dplyr::filter(.data[["equity_market"]] %in% c("Global", "GlobalMarket")) |>
dplyr::filter(.data[["year"]] %in% c(.env[["start_year"]] + 5L)) |>
Expand Down Expand Up @@ -63,8 +62,7 @@ prep_key_bars_portfolio <- function(
dplyr::mutate(asset_class = "Listed Equity") |>
dplyr::mutate_at("id", as.character) # convert the col type to character to prevent errors in case empty df is bound by rows # nolint

Check warning on line 63 in R/prep_key_bars_portfolio.R

View check run for this annotation

Codecov / codecov/patch

R/prep_key_bars_portfolio.R#L13-L63

Added lines #L13 - L63 were not covered by tests

bonds_data_portfolio <-
bonds_results_portfolio |>
bonds_data_portfolio <- bonds_results_portfolio |>
dplyr::filter(.data[["portfolio_name"]] == .env[["portfolio_name"]]) |>
dplyr::filter(.data[["equity_market"]] %in% c("Global", "GlobalMarket")) |>
dplyr::filter(.data[["year"]] %in% c(.env[["start_year"]] + 5L)) |>
Expand Down
18 changes: 6 additions & 12 deletions R/prep_techexposure.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ prep_techexposure <- function(
equity_market_levels,
all_tech_levels
) {
portfolio <-
list(
portfolio <- list(
`Listed Equity` = equity_results_portfolio,

Check warning on line 19 in R/prep_techexposure.R

View workflow job for this annotation

GitHub Actions / R Package Checks / lintr / lint

file=R/prep_techexposure.R,line=19,col=6,[indentation_linter] Indentation should be 4 spaces but is 6 spaces.
`Corporate Bonds` = bonds_results_portfolio
) |>
Expand All @@ -27,25 +26,21 @@ prep_techexposure <- function(
) |>
dplyr::filter(!is.na(.data[["ald_sector"]]))

Check warning on line 27 in R/prep_techexposure.R

View check run for this annotation

Codecov / codecov/patch

R/prep_techexposure.R#L18-L27

Added lines #L18 - L27 were not covered by tests

asset_classes <-
portfolio |>
asset_classes <- portfolio |>
dplyr::pull("asset_class") |>
unique()

Check warning on line 31 in R/prep_techexposure.R

View check run for this annotation

Codecov / codecov/patch

R/prep_techexposure.R#L29-L31

Added lines #L29 - L31 were not covered by tests

equity_sectors <-
portfolio |>
equity_sectors <- portfolio |>
dplyr::filter(.data[["asset_class"]] == "Listed Equity") |>
dplyr::pull("ald_sector") |>
unique()

Check warning on line 36 in R/prep_techexposure.R

View check run for this annotation

Codecov / codecov/patch

R/prep_techexposure.R#L33-L36

Added lines #L33 - L36 were not covered by tests

bonds_sectors <-
portfolio |>
bonds_sectors <- portfolio |>
dplyr::filter(.data[["asset_class"]] == "Corporate Bonds") |>
dplyr::pull("ald_sector") |>
unique()

Check warning on line 41 in R/prep_techexposure.R

View check run for this annotation

Codecov / codecov/patch

R/prep_techexposure.R#L38-L41

Added lines #L38 - L41 were not covered by tests

indices <-
list(
indices <- list(
`Listed Equity` = indices_eq_results_portfolio,

Check warning on line 44 in R/prep_techexposure.R

View workflow job for this annotation

GitHub Actions / R Package Checks / lintr / lint

file=R/prep_techexposure.R,line=44,col=6,[indentation_linter] Indentation should be 4 spaces but is 6 spaces.
`Corporate Bonds` = indices_cb_results_portfolio
) |>
Expand All @@ -61,8 +56,7 @@ prep_techexposure <- function(
)
)

Check warning on line 57 in R/prep_techexposure.R

View check run for this annotation

Codecov / codecov/patch

R/prep_techexposure.R#L43-L57

Added lines #L43 - L57 were not covered by tests

peers <-
list(
peers <- list(
`Listed Equity` = peers_equity_results_portfolio,

Check warning on line 60 in R/prep_techexposure.R

View workflow job for this annotation

GitHub Actions / R Package Checks / lintr / lint

file=R/prep_techexposure.R,line=60,col=6,[indentation_linter] Indentation should be 4 spaces but is 6 spaces.
`Corporate Bonds` = peers_bonds_results_portfolio
) |>
Expand Down
30 changes: 11 additions & 19 deletions R/prep_techmix_sector.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,33 @@ prep_techmix_sector <- function(
all_tech_levels
) {

portfolio <-
list(
`Listed Equity` = equity_results_portfolio,
`Corporate Bonds` = bonds_results_portfolio
) |>
portfolio <- list(
`Listed Equity` = equity_results_portfolio,
`Corporate Bonds` = bonds_results_portfolio
) |>
dplyr::bind_rows(.id = "asset_class") |>
dplyr::filter(
.data[["investor_name"]] == .env[["investor_name"]],
.data[["portfolio_name"]] == .env[["portfolio_name"]]
) |>
dplyr::filter(!is.na(.data[["ald_sector"]]))

Check warning on line 26 in R/prep_techmix_sector.R

View check run for this annotation

Codecov / codecov/patch

R/prep_techmix_sector.R#L17-L26

Added lines #L17 - L26 were not covered by tests

asset_classes <-
portfolio |>
asset_classes <- portfolio |>
dplyr::pull("asset_class") |>
unique()

Check warning on line 30 in R/prep_techmix_sector.R

View check run for this annotation

Codecov / codecov/patch

R/prep_techmix_sector.R#L28-L30

Added lines #L28 - L30 were not covered by tests

equity_sectors <-
portfolio |>
equity_sectors <- portfolio |>
dplyr::filter(.data[["asset_class"]] == "Listed Equity") |>
dplyr::filter(.data[["allocation"]] == "portfolio_weight") |>
dplyr::pull("ald_sector") |>
unique()

Check warning on line 36 in R/prep_techmix_sector.R

View check run for this annotation

Codecov / codecov/patch

R/prep_techmix_sector.R#L32-L36

Added lines #L32 - L36 were not covered by tests

bonds_sectors <-
portfolio |>
bonds_sectors <- portfolio |>
dplyr::filter(.data[["asset_class"]] == "Corporate Bonds") |>
dplyr::pull("ald_sector") |>
unique()

Check warning on line 41 in R/prep_techmix_sector.R

View check run for this annotation

Codecov / codecov/patch

R/prep_techmix_sector.R#L38-L41

Added lines #L38 - L41 were not covered by tests

indices <-
list(
indices <- list(
`Listed Equity` = indices_eq_results_portfolio,

Check warning on line 44 in R/prep_techmix_sector.R

View workflow job for this annotation

GitHub Actions / R Package Checks / lintr / lint

file=R/prep_techmix_sector.R,line=44,col=6,[indentation_linter] Indentation should be 4 spaces but is 6 spaces.
`Corporate Bonds` = indices_cb_results_portfolio
) |>
Expand All @@ -61,8 +56,7 @@ prep_techmix_sector <- function(
)
)

Check warning on line 57 in R/prep_techmix_sector.R

View check run for this annotation

Codecov / codecov/patch

R/prep_techmix_sector.R#L43-L57

Added lines #L43 - L57 were not covered by tests

peers <-
list(
peers <- list(
`Listed Equity` = peers_equity_results_portfolio,

Check warning on line 60 in R/prep_techmix_sector.R

View workflow job for this annotation

GitHub Actions / R Package Checks / lintr / lint

file=R/prep_techmix_sector.R,line=60,col=6,[indentation_linter] Indentation should be 4 spaces but is 6 spaces.
`Corporate Bonds` = peers_bonds_results_portfolio
) |>
Expand All @@ -79,8 +73,7 @@ prep_techmix_sector <- function(
) |>
dplyr::filter(.data[["investor_name"]] == .env[["peer_group"]])

Check warning on line 74 in R/prep_techmix_sector.R

View check run for this annotation

Codecov / codecov/patch

R/prep_techmix_sector.R#L59-L74

Added lines #L59 - L74 were not covered by tests

techexposure_data <-
dplyr::bind_rows(portfolio, peers, indices) |>
techexposure_data <- dplyr::bind_rows(portfolio, peers, indices) |>
dplyr::filter(.data[["allocation"]] == "portfolio_weight") |>
dplyr::filter(.data[["scenario_geography"]] == "Global") |>
dplyr::filter(
Expand All @@ -91,8 +84,7 @@ prep_techmix_sector <- function(
)

if (nrow(techexposure_data) > 0L) {
techexposure_data <-
techexposure_data |>
techexposure_data <- techexposure_data |>
dplyr::mutate(green = .data[["technology"]] %in% .env[["green_techs"]]) |>
dplyr::group_by(
.data[["asset_class"]],
Expand Down
48 changes: 19 additions & 29 deletions R/prep_trajectory_alignment.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ prep_trajectory_alignment <- function(
all_tech_levels
) {

portfolio <-
list(
`Listed Equity` = equity_results_portfolio,
`Corporate Bonds` = bonds_results_portfolio
) |>
portfolio <- list(
`Listed Equity` = equity_results_portfolio,
`Corporate Bonds` = bonds_results_portfolio
) |>
dplyr::bind_rows(.id = "asset_class") |>
dplyr::filter(
.data[["investor_name"]] == .env[["investor_name"]],
Expand All @@ -37,52 +36,44 @@ prep_trajectory_alignment <- function(
dplyr::filter(dplyr::n() > 1L) |>
dplyr::ungroup()

Check warning on line 37 in R/prep_trajectory_alignment.R

View check run for this annotation

Codecov / codecov/patch

R/prep_trajectory_alignment.R#L18-L37

Added lines #L18 - L37 were not covered by tests

asset_classes <-
portfolio |>
asset_classes <- portfolio |>
dplyr::pull("asset_class") |>
unique()

Check warning on line 41 in R/prep_trajectory_alignment.R

View check run for this annotation

Codecov / codecov/patch

R/prep_trajectory_alignment.R#L39-L41

Added lines #L39 - L41 were not covered by tests

equity_markets <-
portfolio |>
equity_markets <- portfolio |>
dplyr::filter(.data[["asset_class"]] == "Listed Equity") |>
dplyr::pull("equity_market") |>
unique()

Check warning on line 46 in R/prep_trajectory_alignment.R

View check run for this annotation

Codecov / codecov/patch

R/prep_trajectory_alignment.R#L43-L46

Added lines #L43 - L46 were not covered by tests

bonds_markets <-
portfolio |>
bonds_markets <- portfolio |>
dplyr::filter(.data[["asset_class"]] == "Corporate Bonds") |>
dplyr::pull("equity_market") |>
unique()

Check warning on line 51 in R/prep_trajectory_alignment.R

View check run for this annotation

Codecov / codecov/patch

R/prep_trajectory_alignment.R#L48-L51

Added lines #L48 - L51 were not covered by tests

equity_techs <-
portfolio |>
equity_techs <- portfolio |>
dplyr::filter(.data[["asset_class"]] == "Listed Equity") |>
dplyr::pull("technology") |>
unique()

Check warning on line 56 in R/prep_trajectory_alignment.R

View check run for this annotation

Codecov / codecov/patch

R/prep_trajectory_alignment.R#L53-L56

Added lines #L53 - L56 were not covered by tests

equity_scenario_geography <-
portfolio |>
equity_scenario_geography <- portfolio |>
dplyr::filter(.data[["asset_class"]] == "Listed Equity") |>
dplyr::pull("scenario_geography") |>
unique()

Check warning on line 61 in R/prep_trajectory_alignment.R

View check run for this annotation

Codecov / codecov/patch

R/prep_trajectory_alignment.R#L58-L61

Added lines #L58 - L61 were not covered by tests

bonds_scenario_geography <-
portfolio |>
bonds_scenario_geography <- portfolio |>
dplyr::filter(.data[["asset_class"]] == "Corporate Bonds") |>
dplyr::pull("scenario_geography") |>
unique()

Check warning on line 66 in R/prep_trajectory_alignment.R

View check run for this annotation

Codecov / codecov/patch

R/prep_trajectory_alignment.R#L63-L66

Added lines #L63 - L66 were not covered by tests

bonds_techs <-
portfolio |>
bonds_techs <- portfolio |>
dplyr::filter(.data[["asset_class"]] == "Corporate Bonds") |>
dplyr::pull("technology") |>
unique()

Check warning on line 71 in R/prep_trajectory_alignment.R

View check run for this annotation

Codecov / codecov/patch

R/prep_trajectory_alignment.R#L68-L71

Added lines #L68 - L71 were not covered by tests

peers <-
list(
`Listed Equity` = peers_equity_results_portfolio,
`Corporate Bonds` = peers_bonds_results_portfolio
) |>
peers <- list(
`Listed Equity` = peers_equity_results_portfolio,
`Corporate Bonds` = peers_bonds_results_portfolio
) |>
dplyr::bind_rows(.id = "asset_class") |>
dplyr::filter(.data[["ald_sector"]] %in% .env[["tech_roadmap_sectors"]]) |>
dplyr::filter(.data[["scenario_geography"]] != "GlobalAggregate") |>
Expand Down Expand Up @@ -116,11 +107,10 @@ prep_trajectory_alignment <- function(
) |>
dplyr::filter(.data[["investor_name"]] == .env[["peer_group"]])

Check warning on line 108 in R/prep_trajectory_alignment.R

View check run for this annotation

Codecov / codecov/patch

R/prep_trajectory_alignment.R#L73-L108

Added lines #L73 - L108 were not covered by tests

indices <-
list(
`Listed Equity` = indices_eq_results_portfolio,
`Corporate Bonds` = indices_cb_results_portfolio
) |>
indices <- list(
`Listed Equity` = indices_eq_results_portfolio,
`Corporate Bonds` = indices_cb_results_portfolio
) |>
dplyr::bind_rows(.id = "asset_class") |>
dplyr::filter(.data[["ald_sector"]] %in% .env[["tech_roadmap_sectors"]]) |>
dplyr::filter(.data[["scenario_geography"]] != "GlobalAggregate") |>
Expand Down
Loading

0 comments on commit 3cbf404

Please sign in to comment.