Koffi-Fredysessie / BRVM

Ce package R fournit une interface conviviale pour accéder aux données de la BRVM, qui est une bourse régionale desservant plusieurs pays d'Afrique de l'Ouest. Avec ce package, les utilisateurs peuvent facilement récupérer des données historiques sur les prix des actions, les volumes de transactions et d'autres indicateurs financiers.
https://rpubs.com/Fredysessie/Readme_BRVM_Stock
Other
8 stars 1 forks source link

Function to get companies sector through it name #23

Closed Fredysessie closed 2 years ago

Fredysessie commented 2 years ago

This code will be add in the rshiny app. If users want to use it, directly in R we must add some news parameters such length(company)==1 and others.

company_sector <- function(company){

company<-toupper(company)

.sectors =list(Agriculture = c("PALC","SCRC","SICC","SOGC","SPHC"),
          Distribution = c("ABJC","BNBC","CFAC","PRSC","SHEC","TTLC","TTLS"),
          Industry = c("CABC","FTSC","NEIC","NTLC","SEMC","SIVC","SLBC","SMBC","STBC","TTRC","UNLC","UNXC"),
          Finance = c("BOAB","BOABF","BOAC","BOAM","BOAN","BOAS","BICC","CBIBF","ECOC","ETIT","NSBC","ORGT","SAFC","SGBC","SIBC"),
          Transport = c("SDSC","SVOC"),
          "Public service" = c("CIEC","ONTBF","SDCC","SNTS"),
          Other = c("STAC"))

 for (elem in 1 :length(.sectors)){
   # if (input$ticker %in% .sectors[[elem]]) {
   if (company %in% .sectors[[elem]]) {     
     return(names(.sectors)[[elem]])
   }
 }
}