# assign the url to `github_raw_csv_url`github_raw_csv_url <-"https://raw.githubusercontent.com/t-emery/sais-susfin_data/main/datasets/blackrock_etf_screener_2022-08-30.csv"# read in the data, and assign it to the object `blackrock_etf_data`blackrock_etf_data <-read_csv(github_raw_csv_url)
Rows: 393 Columns: 22
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (14): ticker, name, incept_date, net_assets_as_of, asset_class, sub_asse...
dbl (8): gross_expense_ratio_percent, net_expense_ratio_percent, net_assets...
ℹ 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.
# print out the tibble to take a look at the datablackrock_etf_data
mini_blackrock_data <- blackrock_etf_data |># group by whether the fund is an ESG fund or notgroup_by(is_esg) |># take the top 5 from each group, by net assetsslice_max(order_by = net_assets_usd_mn, n =5) |># select the following columns select(ticker, name, asset_class, sub_asset_class, region, incept_date, net_assets_usd_mn, msci_weighted_average_carbon_intensity_tons_co2e_m_sales) |># rename to `co2_intensity` because the full name is a mouthful, if descriptive.rename(co2_intensity = msci_weighted_average_carbon_intensity_tons_co2e_m_sales) |># always good to ungroup() if you've used a group_by(). We'll discuss later.ungroup()
Adding missing grouping variables: `is_esg`
mini_blackrock_data
# A tibble: 10 × 9
is_esg ticker name asset…¹ sub_a…² region incep…³ net_a…⁴ co2_i…⁵
<chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
1 ESG Fund ESGU iShares E… Equity Large/… North… 12/1/16 22377. 104.
2 ESG Fund ESGD iShares E… Equity Large/… Global 6/28/16 6426. 104.
3 ESG Fund ICLN iShares G… Equity All Cap Global 6/24/08 5628. 266.
4 ESG Fund ESGE iShares E… Equity Large/… Global 6/28/16 4234. 168.
5 ESG Fund DSI iShares M… Equity Large/… North… 11/14/… 3689. 72.7
6 Regular Fund IVV iShares C… Equity Large … North… 5/15/00 297663. 148.
7 Regular Fund IEFA iShares C… Equity All Cap Global 10/18/… 84222. 127.
8 Regular Fund AGG iShares C… Fixed … Multi … North… 9/22/03 82344. 283.
9 Regular Fund IJR iShares C… Equity Small … North… 5/22/00 66533. 133.
10 Regular Fund IEMG iShares C… Equity All Cap Global 10/18/… 64920. 369.
# … with abbreviated variable names ¹asset_class, ²sub_asset_class,
# ³incept_date, ⁴net_assets_usd_mn, ⁵co2_intensity
# A tibble: 10 × 3
is_esg name net_assets_usd_mn
<chr> <chr> <dbl>
1 ESG Fund iShares ESG Aware MSCI USA ETF 22377.
2 ESG Fund iShares ESG Aware MSCI EAFE ETF 6426.
3 ESG Fund iShares Global Clean Energy ETF 5628.
4 ESG Fund iShares ESG Aware MSCI EM ETF 4234.
5 ESG Fund iShares MSCI KLD 400 Social ETF 3689.
6 Regular Fund iShares Core S&P 500 ETF 297663.
7 Regular Fund iShares Core MSCI EAFE ETF 84222.
8 Regular Fund iShares Core U.S. Aggregate Bond ETF 82344.
9 Regular Fund iShares Core S&P Small-Cap ETF 66533.
10 Regular Fund iShares Core MSCI Emerging Markets ETF 64920.
mini_blackrock_data |>select(contains("asset"))
# A tibble: 10 × 3
asset_class sub_asset_class net_assets_usd_mn
<chr> <chr> <dbl>
1 Equity Large/Mid Cap 22377.
2 Equity Large/Mid Cap 6426.
3 Equity All Cap 5628.
4 Equity Large/Mid Cap 4234.
5 Equity Large/Mid Cap 3689.
6 Equity Large Cap 297663.
7 Equity All Cap 84222.
8 Fixed Income Multi Sectors 82344.
9 Equity Small Cap 66533.
10 Equity All Cap 64920.
# A tibble: 0 × 9
# … with 9 variables: is_esg <chr>, ticker <chr>, name <chr>,
# asset_class <chr>, sub_asset_class <chr>, region <chr>, incept_date <chr>,
# net_assets_usd_mn <dbl>, co2_intensity <dbl>
mini_blackrock_data |>#select the columns we wantselect(name, is_esg, incept_date) |># use mdy() from the lubridate package to turn the character string into a date objectmutate(incept_date = lubridate::mdy(incept_date))
# A tibble: 10 × 3
name is_esg incept_date
<chr> <chr> <date>
1 iShares ESG Aware MSCI USA ETF ESG Fund 2016-12-01
2 iShares ESG Aware MSCI EAFE ETF ESG Fund 2016-06-28
3 iShares Global Clean Energy ETF ESG Fund 2008-06-24
4 iShares ESG Aware MSCI EM ETF ESG Fund 2016-06-28
5 iShares MSCI KLD 400 Social ETF ESG Fund 2006-11-14
6 iShares Core S&P 500 ETF Regular Fund 2000-05-15
7 iShares Core MSCI EAFE ETF Regular Fund 2012-10-18
8 iShares Core U.S. Aggregate Bond ETF Regular Fund 2003-09-22
9 iShares Core S&P Small-Cap ETF Regular Fund 2000-05-22
10 iShares Core MSCI Emerging Markets ETF Regular Fund 2012-10-18
mini_blackrock_data |>#select the columns we wantselect(name, is_esg, incept_date) |># use mdy() from the lubridate package to turn the character string into a date objectmutate(incept_date = lubridate::mdy(incept_date),# extract the year from the dateincept_year = lubridate::year(incept_date),# calculate how many years since the fund was launched.years_since_incept = lubridate::interval(incept_date, Sys.Date())/lubridate::years(1))
# A tibble: 10 × 5
name is_esg incept_d…¹ incep…² years…³
<chr> <chr> <date> <dbl> <dbl>
1 iShares ESG Aware MSCI USA ETF ESG Fund 2016-12-01 2016 6.19
2 iShares ESG Aware MSCI EAFE ETF ESG Fund 2016-06-28 2016 6.62
3 iShares Global Clean Energy ETF ESG Fund 2008-06-24 2008 14.6
4 iShares ESG Aware MSCI EM ETF ESG Fund 2016-06-28 2016 6.62
5 iShares MSCI KLD 400 Social ETF ESG Fund 2006-11-14 2006 16.2
6 iShares Core S&P 500 ETF Regular Fu… 2000-05-15 2000 22.7
7 iShares Core MSCI EAFE ETF Regular Fu… 2012-10-18 2012 10.3
8 iShares Core U.S. Aggregate Bond ETF Regular Fu… 2003-09-22 2003 19.4
9 iShares Core S&P Small-Cap ETF Regular Fu… 2000-05-22 2000 22.7
10 iShares Core MSCI Emerging Markets ETF Regular Fu… 2012-10-18 2012 10.3
# … with abbreviated variable names ¹incept_date, ²incept_year,
# ³years_since_incept
# A tibble: 5 × 3
sub_asset_class sum_co2_intensity avg_assets_mn
<chr> <dbl> <dbl>
1 All Cap 761. 254.
2 Large Cap 148. 148.
3 Large/Mid Cap 448. 112.
4 Multi Sectors 283. 283.
5 Small Cap 133. 133.