#load the tidyverse
library(tidyverse)── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.4.4 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.1
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readr)
options(scipen = 999)
blackrock_etf_screener <- read_csv("https://raw.githubusercontent.com/t-emery/sais-susfin_data/main/datasets/ishares_etf_screener_as_of_2023-12-27.csv") Rows: 424 Columns: 18
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (10): ticker, name, asset_class, sub_asset_class, region, market, locat...
dbl (6): gross_expense_ratio_percent, net_expense_ratio_percent, net_asset...
dttm (2): incept_date, net_assets_as_of
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
blackrock_etf_screener_w_new_features <- blackrock_etf_screener |>
mutate(
# if the sustainable_classification column is NA, then the fund is not an ESG fund.
standard_or_esg = if_else(
condition = is.na(sustainable_classification),
true = "Standard",
false = "ESG"
),
# lubridate::year() extracts the year from a date
inception_year = lubridate::year(incept_date),
# Change to a meaningful magnitude for the data. In asset management, billions is a good default.
net_assets_bn_usd = net_assets_usd/10^9,
# let's put our new variables at the front so we can see them easily.
.before = everything()
)
largest_funds_by_category <- blackrock_etf_screener_w_new_features |>
filter(standard_or_esg == "ESG") |>
group_by(sustainable_classification) |>
summarize(
LargestFund = first(ticker[which.max(net_assets_bn_usd)]),
LargestFundAssets=
max(net_assets_bn_usd),
TotalCategoryAssets = sum(net_assets_bn_usd)
) |>
ungroup() |>
mutate(PercentOfCategoryAssets = (LargestFundAssets / TotalCategoryAssets) * 100) |>
arrange(desc(PercentOfCategoryAssets))
largest_funds_by_category# A tibble: 4 × 5
sustainable_classification LargestFund LargestFundAssets TotalCategoryAssets
<chr> <chr> <dbl> <dbl>
1 Impact BGRN 0.335 0.335
2 Thematic ICLN 3.06 3.43
3 Screened XVV 0.182 0.383
4 Uplift ESGU 13.4 51.4
# ℹ 1 more variable: PercentOfCategoryAssets <dbl>