The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
library(ggplot2)library(lubridate)
Attaching package: 'lubridate'
The following objects are masked from 'package:base':
date, intersect, setdiff, union
# Read the dataset - Make sure the path points directly to the filegreen_bonds_data <-read_csv("/Users/enmingliang/Desktop/Finalproject/00_data_raw/Green_Bonds_since_2008_20240403.csv")
Rows: 359 Columns: 10
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (6): Type, Currency, Settlement Date, Maturity Date, ISIN, Final Terms
dbl (2): Maturity, Coupon
num (2): Volume, USD Equivalent
ℹ 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.
# Convert "Settlement Date" to Date format and "USD Equivalent" to numericgreen_bonds_data$`Settlement Date`<-as.Date(green_bonds_data$`Settlement Date`, format="%m/%d/%Y %I:%M:%S %p")green_bonds_data$`USD Equivalent`<-as.numeric(gsub(",", "", green_bonds_data$`USD Equivalent`))# Extract year from "Settlement Date"green_bonds_data$Year <-year(green_bonds_data$`Settlement Date`)# Aggregate issuance volume by yearannual_issuance_volume <- green_bonds_data %>%group_by(Year) %>%summarise(Total_Issuance_Volume_USD =sum(`USD Equivalent`, na.rm =TRUE))# Plot the annual issuance volumeggplot(annual_issuance_volume, aes(x=Year, y=Total_Issuance_Volume_USD)) +geom_bar(stat="identity", fill="green") +theme_minimal() +labs(title="Annual Green Bond Issuance Volume (USD)",x="Year",y="Total Issuance Volume (USD)") +theme(axis.text.x =element_text(angle =45, hjust =1))