#PROJECT-7: Analysis of Assets Under Management(AUM) of Indian Mutual Funds
knitr::opts_chunk$set(root.dir = "C:/Users/rsman/Documents/PERS FOLDERS/RAJDEEP/WEB SITE/Project-7-AUM-FII")
library(pander)
library(xlsx)
library(ggplot2)
library(scales)
library(dplyr)
library(kableExtra)
library(DT)
library(jpeg)
getwd()
## [1] "C:/Users/rsman/Documents/PERS FOLDERS/RAJDEEP/WEB SITE/Project-7-AUM-FII"
Project Description
colFmt = function(x,color){
outputFormat = knitr::opts_knit$get("rmarkdown.pandoc.to")
if(outputFormat == 'html')
paste("<font color='",color,"'>",x,"</font>",sep="")
else
x
}
aum.df <- as.data.frame(read.xlsx("aum.xlsx", sheetIndex = 1))
aum.df$AUM_Cr <- as.numeric(as.character(aum.df$AUM_Cr))
aum.df$year <- as.numeric(as.character(aum.df$year))
aum.df$Type.2 <- as.character(aum.df$Type.2)
aum.df$mth_yr <- paste0(aum.df$month,"-", aum.df$year)
min_yr <- min(aum.df$year)
max_yr <- max(aum.df$year)
ctr1.df <- as.data.frame(unique(aum.df$Type.2))
str(ctr1.df)
‘data.frame’: 15 obs. of 1 variable: $ unique(aum.df$Type.2): chr “Liquid/Money Market” “Gilt” “Debt Oriented” “Equity Oriented” …
disp.table <- function(rx_tbl, lpr){
master_tbl <- rx_tbl[,c(2,3,4,5,6,7,8)]
master_tbl$Percent_AUM <- master_tbl$Percent_AUM/100
master_tbl$Percent_Folio <- master_tbl$Percent_Folio/100
disp.caption <- paste0("AUM OF ALL INVESTORS IN ", ctr1.df[lpr,1], " SCHEMES FROM ", min_yr, " TO ", max_yr)
genr.dt <- datatable(master_tbl, filter = "top", options = list(scrollY = '400px'), rownames = FALSE,
caption = htmltools::tags$caption(disp.caption, style="color:red")) %>% formatPercentage('Percent_AUM',2)%>% formatPercentage('Percent_Folio',2)
return(genr.dt)
}
pandoc.header(colFmt("Section-1: AUM Tables for All Schemes/Types", 'red'), 1, 'setext')
pandoc.header(colFmt( paste("1A. Change in AUM from ", min_yr, " To ", max_yr, "FOR ALL INVESTOR TYPES"), 'blue'), 1, 'setext')
knitr::include_graphics("AUM-ALL TYPES2.jpg", dpi = 2)
Insights The AUM of various categories can be seen above.
ctr <- 1
pandoc.header(colFmt( paste("1B. AUM in ", ctr1.df[ctr,1],"Schemes"), 'blue'), 1, 'setext')
disp.table(aum.df[aum.df$Type.2 == ctr1.df[ctr,1],], ctr)
ctr <- ctr +1
pandoc.header(colFmt( paste("1C. AUM in ", ctr1.df[ctr,1],"Schemes"), 'blue'), 1, 'setext')
disp.table(aum.df[aum.df$Type.2 == ctr1.df[ctr,1],], ctr)
ctr <- ctr +1
pandoc.header(colFmt( paste("1D. AUM in ", ctr1.df[ctr,1],"Schemes"), 'blue'), 1, 'setext')
disp.table(aum.df[aum.df$Type.2 == ctr1.df[ctr,1],], ctr)
ctr <- ctr +1
pandoc.header(colFmt( paste("1E. AUM in ", ctr1.df[ctr,1],"Schemes"), 'blue'), 1, 'setext')
disp.table(aum.df[aum.df$Type.2 == ctr1.df[ctr,1],], ctr)
ctr <- ctr +1
pandoc.header(colFmt( paste("1F. AUM in ", ctr1.df[ctr,1],"Schemes"), 'blue'), 1, 'setext')
disp.table(aum.df[aum.df$Type.2 == ctr1.df[ctr,1],], ctr)
ctr <- ctr +1
pandoc.header(colFmt( paste("1G. AUM in ", ctr1.df[ctr,1],"Schemes"), 'blue'), 1, 'setext')
disp.table(aum.df[aum.df$Type.2 == ctr1.df[ctr,1],], ctr)
ctr <- ctr +1
pandoc.header(colFmt( paste("1H. AUM in ", ctr1.df[ctr,1],"Schemes"), 'blue'), 1, 'setext')
disp.table(aum.df[aum.df$Type.2 == ctr1.df[ctr,1],], ctr)
ctr <- ctr +1
pandoc.header(colFmt( paste("1J. AUM in ", ctr1.df[ctr,1],"Schemes"), 'blue'), 1, 'setext')
disp.table(aum.df[aum.df$Type.2 == ctr1.df[ctr,1],], ctr)
ctr <- ctr +1
pandoc.header(colFmt( paste("1K. AUM in ", ctr1.df[ctr,1],"Schemes"), 'blue'), 1, 'setext')
disp.table(aum.df[aum.df$Type.2 == ctr1.df[ctr,1],], ctr)
ctr <- ctr +1
pandoc.header(colFmt( paste("1L. AUM in ", ctr1.df[ctr,1],"Schemes"), 'blue'), 1, 'setext')
disp.table(aum.df[aum.df$Type.2 == ctr1.df[ctr,1],], ctr)
ctr <- ctr +1
pandoc.header(colFmt( paste("1M. AUM in ", ctr1.df[ctr,1],"Schemes"), 'blue'), 1, 'setext')
disp.table(aum.df[aum.df$Type.2 == ctr1.df[ctr,1],], ctr)
ctr <- ctr +1
pandoc.header(colFmt( paste("1N. AUM in ", ctr1.df[ctr,1],"Schemes"), 'blue'), 1, 'setext')
disp.table(aum.df[aum.df$Type.2 == ctr1.df[ctr,1],], ctr)
pandoc.header(colFmt(paste("Section-2: Change in AUM of corporates from ", min_yr, " to ", max_yr), 'red'), 1, 'setext')
master_tbl <- aum.df[aum.df$Investor.Classification == "Corporates" ,]
#master_tbl <- master_tbl[order(master_tbl$year, master_tbl$AUM_Cr),]
plot.genr <- ggplot(master_tbl, aes(x=factor(year), y= AUM_Cr, fill = factor(Type.2))) +
geom_bar(stat='identity')+
theme(axis.text.x=element_text(angle = 90, hjust = 0, face = "bold", size = 20),
axis.text.y =element_text(face = "bold", size = 20))+
scale_y_continuous(labels = comma) + ggtitle(paste("Corporates Total AUM in all Schemes from ", min_yr, " To ", max_yr )) +
xlab('') + ylab('AUM(In Cr)') +
theme(plot.title = element_text(size = 30, face = "bold", hjust = c(0,0)), legend.title = element_blank(), legend.position = c(.16,.8)) + theme(legend.text=element_text(size=15))
plot.genr
pandoc.header(colFmt(paste("Section-3: Change in AUM of High Networth Individuals (HNI's) from ", min_yr, " to ", max_yr), 'red'), 1, 'setext')
master_tbl <- aum.df[aum.df$Investor.Classification == "High Networth Individuals*" ,]
#master_tbl <- master_tbl[order(master_tbl$year, master_tbl$AUM_Cr),]
plot.genr <- ggplot(master_tbl, aes(x=factor(year), y= AUM_Cr, fill = factor(Type.2))) +
geom_bar(stat='identity')+
theme(axis.text.x=element_text(angle = 90, hjust = 0, face = "bold", size = 20),
axis.text.y =element_text(face = "bold", size = 20))+
scale_y_continuous(labels = comma) + ggtitle(paste("HNIs Total AUM in all Schemes from ", min_yr, " To ", max_yr )) +
xlab('') + ylab('AUM(In Cr)') +
theme(plot.title = element_text(size = 30, face = "bold", hjust = c(0,0)), legend.title = element_blank(), legend.position = c(.16,.8)) + theme(legend.text=element_text(size=15))
plot.genr
pandoc.header(colFmt(paste("Section-4: Change in AUM of Retail from ", min_yr, " to ", max_yr), 'red'), 1, 'setext')
master_tbl <- aum.df[aum.df$Investor.Classification == "Retail" ,]
#master_tbl <- master_tbl[order(master_tbl$year, master_tbl$AUM_Cr),]
plot.genr <- ggplot(master_tbl, aes(x=factor(year), y= AUM_Cr, fill = factor(Type.2))) +
geom_bar(stat='identity')+
theme(axis.text.x=element_text(angle = 90, hjust = 0, face = "bold", size = 20),
axis.text.y =element_text(face = "bold", size = 20))+
scale_y_continuous(labels = comma) + ggtitle(paste("Retail Total AUM in all Schemes from ", min_yr, " To ", max_yr )) +
xlab('') + ylab('AUM(In Cr)') +
theme(plot.title = element_text(size = 30, face = "bold", hjust = c(0,0)), legend.title = element_blank(), legend.position = c(.16,.8)) + theme(legend.text=element_text(size=15))
plot.genr
pandoc.header(colFmt(paste("Section-5: Change in AUM of FII's from ", min_yr, " to ", max_yr), 'red'), 1, 'setext')
master_tbl <- aum.df[aum.df$Investor.Classification == "FIIs" ,]
#master_tbl <- master_tbl[order(master_tbl$year, master_tbl$AUM_Cr),]
plot.genr <- ggplot(master_tbl , aes(x=master_tbl$year , y= master_tbl$AUM_Cr )) +
geom_line(aes(colour=master_tbl$Type.2, group=master_tbl$Type.2), show.legend = TRUE)+
geom_point(aes(colour=master_tbl$Type.2), size=3, show.legend = TRUE)+
theme(axis.text.x=element_text(angle = 90, hjust = 0))+
scale_y_continuous(labels = comma)
plot.genr <- ggplot(master_tbl, aes(x=factor(year), y= AUM_Cr, fill = factor(Type.2))) +
geom_bar(stat='identity')+
theme(axis.text.x=element_text(angle = 90, hjust = 0, face = "bold", size = 20),
axis.text.y =element_text(face = "bold", size = 20))+
scale_y_continuous(labels = comma) + ggtitle(paste("FIIs Total AUM in all Schemes from ", min_yr, " To ", max_yr )) +
xlab('') + ylab('AUM(In Cr)') +
theme(plot.title = element_text(size = 30, face = "bold", hjust = c(0,0)), legend.title = element_blank(), legend.position = c(.86,.8)) + theme(legend.text=element_text(size=15))
plot.genr
pandoc.header(colFmt(paste("Section-6: Change in AUM of Banks/FI's from ", min_yr, " to ", max_yr), 'red'), 1, 'setext')
master_tbl <- aum.df[aum.df$Investor.Classification == "Banks/FIs" ,]
#master_tbl <- master_tbl[order(master_tbl$year, master_tbl$AUM_Cr),]
plot.genr <- ggplot(master_tbl , aes(x=master_tbl$year , y= master_tbl$AUM_Cr )) +
geom_line(aes(colour=master_tbl$Type.2, group=master_tbl$Type.2), show.legend = TRUE)+
geom_point(aes(colour=master_tbl$Type.2), size=3, show.legend = TRUE)+
theme(axis.text.x=element_text(angle = 90, hjust = 0))+
scale_y_continuous(labels = comma)
plot.genr <- ggplot(master_tbl, aes(x=factor(year), y= AUM_Cr, fill = factor(Type.2))) +
geom_bar(stat='identity')+
theme(axis.text.x=element_text(angle = 90, hjust = 0, face = "bold", size = 20),
axis.text.y =element_text(face = "bold", size = 20))+
scale_y_continuous(labels = comma) + ggtitle(paste("Banks/FIs Total AUM in all Schemes from ", min_yr, " To ", max_yr )) +
xlab('') + ylab('AUM(In Cr)') +
theme(plot.title = element_text(size = 30, face = "bold", hjust = c(0,0)), legend.title = element_blank(), legend.position = c(.16,.8)) + theme(legend.text=element_text(size=15))
plot.genr
pandoc.header(colFmt(paste("Section-7: Change in No of Folio and AUM per Folio from ", min_yr, " to ", max_yr), 'red'), 1, 'setext')
prtflo.percent.df <- data.frame(matrix(ncol = 4, nrow = 0))
colnames(prtflo.percent.df) <- c("tot_AUM", "tot_folio", "year")
for (ctr in min_yr:max_yr) {
prtflo.df <- aum.df[aum.df$year == ctr,]
temp1.df <- tapply(prtflo.df$AUM_Cr, prtflo.df$Investor.Classification,sum)
temp2.df <- tapply(prtflo.df$No_of_Folio, prtflo.df$Investor.Classification,sum)
temp.df <- as.data.frame(cbind(temp1.df, temp2.df))
colnames(temp.df) <- c("tot_AUM", "tot_folio")
temp.df$year <- ctr
temp.df$Investor.Type <- rownames(temp.df)
prtflo.percent.df <- rbind(prtflo.percent.df, temp.df)
}
rownames(prtflo.percent.df) <- rep(1:length(prtflo.percent.df$tot_AUM))
prtflo.percent.df$aum_per_folio <- prtflo.percent.df$tot_AUM/prtflo.percent.df$tot_folio
plot.data.df <- prtflo.percent.df[prtflo.percent.df$Investor.Type == "FIIs",]
pandoc.header(colFmt(paste("7A. Change in No of Folio from ", min_yr, " to ", max_yr), 'blue'), 1, 'setext')
ggplot(prtflo.percent.df, aes(x=prtflo.percent.df$year, y=prtflo.percent.df$tot_folio)) +
geom_line(aes(colour=prtflo.percent.df$Investor.Type, group=prtflo.percent.df$Investor.Type), size=1.2)+
geom_point(aes(colour=prtflo.percent.df$Investor.Type), size=3)+
theme(axis.text.x=element_text(angle = 90, hjust = 0, face = "bold", size = 20),
axis.text.y =element_text(face = "bold", size = 20)) + scale_y_continuous(labels = comma) +
ggtitle(paste("Change in AUM per Folio from ", min_yr, " To ", max_yr )) +
xlab('Year')+ ylab('AUM per Folio')+
theme(axis.title.x = element_text(size = 20, face = 'bold'),
axis.title.y = element_text(size = 20, face = 'bold')) +
theme(plot.title = element_text(size = 30, face = "bold", hjust = c(0,0)), legend.title = element_blank(), legend.position = c(.50,.42)) +
theme(legend.text=element_text(size=25))
pandoc.header(colFmt(paste("7B. Change in AUM per Folio from ", min_yr, " to ", max_yr), 'blue'), 1, 'setext')
ggplot(prtflo.percent.df, aes(x=prtflo.percent.df$year, y=prtflo.percent.df$aum_per_folio)) +
geom_line(aes(colour=prtflo.percent.df$Investor.Type, group=prtflo.percent.df$Investor.Type), size=1.2)+
geom_point(aes(colour=prtflo.percent.df$Investor.Type), size=3)+
theme(axis.text.x=element_text(angle = 90, hjust = 0, face = "bold", size = 20),
axis.text.y =element_text(face = "bold", size = 20)) +
ggtitle(paste("Change in AUM per Folio from ", min_yr, " To ", max_yr )) +
xlab('Year')+ ylab('AUM per Folio')+
theme(axis.title.x = element_text(size = 20, face = 'bold'),
axis.title.y = element_text(size = 20, face = 'bold')) +
theme(plot.title = element_text(size = 30, face = "bold", hjust = c(0,0)), legend.title = element_blank(), legend.position = c(.50,.42)) +
theme(legend.text=element_text(size=25))