institutionChoice <- function(keyword, universe) {
companyUniverse <- universe %>% filter(grepl(keyword, Name))
MSCI <- companyUniverse %>% filter(grepl(msciKeyword,Primary.Prospectus.Benchmark))
FTSE <- companyUniverse %>% filter(grepl(ftseKeyword,Primary.Prospectus.Benchmark))
STOXX <- companyUniverse %>% filter(grepl(stoxxKeyword,Primary.Prospectus.Benchmark))
SPDJ <- companyUniverse %>% filter(grepl(spdjKeyword,Primary.Prospectus.Benchmark))
fundsCount <- c(length(MSCI$Name),length(FTSE$Name),length(STOXX$Name),length(SPDJ$Name))
fundsPercent <- fundsCount/sum(fundsCount)
countTable <- data.frame(provider=provider, fundsCount=fundsCount, fundsPercent=fundsPercent)
return(countTable)
}
plotInstitutionChoice <- function(keyword, universe) {
companyUniverse <- universe %>% filter(grepl(keyword, Name))
MSCI <- companyUniverse %>% filter(grepl(msciKeyword,Primary.Prospectus.Benchmark))
FTSE <- companyUniverse %>% filter(grepl(ftseKeyword,Primary.Prospectus.Benchmark))
STOXX <- companyUniverse %>% filter(grepl(stoxxKeyword,Primary.Prospectus.Benchmark))
SPDJ <- companyUniverse %>% filter(grepl(spdjKeyword,Primary.Prospectus.Benchmark))
fundsCount <- c(length(MSCI$Name),length(FTSE$Name),length(STOXX$Name),length(SPDJ$Name))
fundsPercent <- fundsCount/sum(fundsCount)
data.frame(provider=provider, fundsCount=fundsCount, fundsPercent=fundsPercent) %>%
ggplot(aes(x=provider, y=fundsCount, fill=provider)) +
geom_bar(stat="identity") +
geom_label(fill='white',aes(label=toP(fundsCount, fundsPercent))) +
fillTheme
}
getInstitutionChoice <- function(keyword, universe) {
companyUniverse <- universe %>% filter(grepl(keyword, Name))
MSCI <- companyUniverse %>% filter(grepl(msciKeyword,Primary.Prospectus.Benchmark))
FTSE <- companyUniverse %>% filter(grepl(ftseKeyword,Primary.Prospectus.Benchmark))
STOXX <- companyUniverse %>% filter(grepl(stoxxKeyword,Primary.Prospectus.Benchmark))
SPDJ <- companyUniverse %>% filter(grepl(spdjKeyword,Primary.Prospectus.Benchmark))
return(list(MSCI=MSCI, FTSE=FTSE, STOXX=STOXX, SPDJ=SPDJ))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.