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.
library(dplyr)# Filter ESG fundsesg_funds <- blackrock_etf_screener %>%filter(!is.na(sustainable_classification) & sustainable_classification !="")# Group by sustainable classification and find the largest fund in terms of net assetslargest_funds <- esg_funds %>%group_by(sustainable_classification) %>%filter(net_assets_usd ==max(net_assets_usd, na.rm =TRUE)) %>%ungroup()# Calculate the total net assets for each sustainable classificationtotal_assets <- esg_funds %>%group_by(sustainable_classification) %>%summarize(total_net_assets =sum(net_assets_usd, na.rm =TRUE))# Join total assets with the largest fundslargest_funds <- largest_funds %>%left_join(total_assets, by ="sustainable_classification") %>%mutate(percent_of_assets = net_assets_usd / total_net_assets *100) %>%arrange(desc(percent_of_assets))# Print the resulting tibbleprint(largest_funds)
library(ggplot2)# Sort the data by net assets in ascending order and select the 10 smallest ETFssmallest_etfs <- blackrock_etf_screener %>%arrange(net_assets_usd) %>%head(10)# Create a bar chartbar_chart <-ggplot(smallest_etfs, aes(x =fct_reorder(name, net_assets_usd), y = net_assets_usd)) +geom_bar(stat ="identity", fill ="skyblue", width =0.5) +labs(title ="Top 10 Smallest ETFs by Net Assets",x ="ETF Name",y ="Net Assets (USD)") +theme(axis.text.x =element_text(angle =45, hjust =1))# Display the bar chartprint(bar_chart)
Question 3
library(dplyr)# Find the bottom quintile of the MSCI ESG quality scorebottom_quintile <- blackrock_etf_screener %>%filter(!is.na(msci_esg_quality_score_0_10)) %>%mutate(quality_quintile =ntile(msci_esg_quality_score_0_10, 5)) %>%filter(quality_quintile ==1)# Print the bottom quintile of the MSCI ESG quality scoreprint("Bottom Quintile of MSCI ESG Quality Score:")
# Calculate the number of funds by total assets by asset classby_asset_class <- bottom_quintile %>%group_by(asset_class) %>%summarize(num_funds =n(),total_assets =sum(net_assets_usd))# Calculate the number of funds by total assets by sub-asset classby_sub_asset_class <- bottom_quintile %>%group_by(sub_asset_class) %>%summarize(num_funds =n(),total_assets =sum(net_assets_usd))# Print the resultsprint("Number of funds by total assets by asset class:")
[1] "Number of funds by total assets by asset class:"
print(by_asset_class)
# A tibble: 3 × 3
asset_class num_funds total_assets
<chr> <int> <dbl>
1 Equity 51 327053099481.
2 Fixed Income 21 56249713527.
3 Real Estate 4 7145439523.
print("Number of funds by total assets by sub-asset class:")
[1] "Number of funds by total assets by sub-asset class:"
print(by_sub_asset_class)
# A tibble: 9 × 3
sub_asset_class num_funds total_assets
<chr> <int> <dbl>
1 All Cap 23 95486052602.
2 Corporates 1 41339182.
3 Credit 1 408038372.
4 Government 3 17560711395.
5 High Yield 16 38239624578.
6 Large Cap 1 1852506812.
7 Large/Mid Cap 10 42421984678.
8 Real Estate Securities 4 7145439523.
9 Small Cap 17 187292555389.
# A tibble: 5 × 2
sub_asset_class total_net_assets
<chr> <dbl>
1 Large/Mid Cap 536807760165.
2 All Cap 508312247338.
3 Large Cap 505828620151.
4 Small Cap 201397234132.
5 Mid Cap 155402513637.
library(ggplot2)# Create bar plot for MSCI ESG Fund Ratingsggplot(data = blackrock_etf_screener, aes(x = msci_esg_fund_rating_aaa_ccc)) +geom_bar(fill ="skyblue", color ="black") +labs(title ="Distribution of ESG Fund Ratings",x ="MSCI ESG Fund Rating",y ="Count")
2)Comparison of Expense Ratios:
# Create boxplot for comparison of gross expense ratio percent by asset classggplot(data = blackrock_etf_screener, aes(x = asset_class, y = gross_expense_ratio_percent)) +geom_boxplot(fill ="lightgreen", color ="black") +labs(title ="Comparison of Gross Expense Ratios by Asset Class",x ="Asset Class",y ="Gross Expense Ratio (%)")
3)Geographical Distribution of ESG Funds:
# Create bar chart for number of ESG funds by regionggplot(data = blackrock_etf_screener, aes(x = region)) +geom_bar(fill ="orange") +labs(title ="Number of ESG Funds by Region",x ="Region",y ="Number of Funds") +theme(axis.text.x =element_text(angle =45, hjust =1))
4) Trend in Net Assets Over Time:
# Create line chart for trend in net assets over timeggplot(data = blackrock_etf_screener, aes(x = incept_date, y = net_assets_usd)) +geom_line(color ="blue") +labs(title ="Trend in Net Assets of ESG Funds Over Time",x ="Inception Date",y ="Net Assets (USD)")
5) Top Sub-Asset Classes by Total Net Assets:
library(dplyr)# Calculate total net assets by sub-asset classnet_assets_by_sub_asset <- blackrock_etf_screener %>%group_by(sub_asset_class) %>%summarize(total_net_assets =sum(net_assets_usd, na.rm =TRUE)) %>%top_n(10, total_net_assets) # Select top 10 sub-asset classes# Create horizontal bar chart for top sub-asset classes by total net assetsggplot(data = net_assets_by_sub_asset, aes(x = total_net_assets, y =fct_reorder(sub_asset_class, total_net_assets))) +geom_bar(stat ="identity", fill ="purple") +labs(title ="Top Sub-Asset Classes by Total Net Assets",x ="Total Net Assets (USD)",y ="Sub-Asset Class") +theme(axis.text.y =element_text(size =8))