# Wrangle for the datatable to show company names, sector, weights.

EEM <- emerging_market_fund %>% 
  select(Name, Country, Sector, `Weight (%)`, `Market Value`) %>% 
  mutate(Country = replace(Country, Country == "Russian Federation", "Russia"), 
         Country = replace(Country, Country == "Korea (South)", "Korea"),
         Country = replace(Country, Country == "Czech Republic", "Czech Rep.")
         ) %>% 
  filter(`Weight (%)` > 0) %>% 
  filter(Country != "-") 

# Let's test it on Brazil to make sure it works.

Brazil_companies <- EEM %>%
  filter(Country == "Brazil") %>% 
  ungroup() %>% 
  select(-Country)

Brazil_companies
## # A tibble: 59 × 4
##                                  Name                 Sector `Weight (%)`
##                                 <chr>                  <chr>        <dbl>
## 1       ITAU UNIBANCO HOLDING PREF SA             Financials       0.9288
## 2              BANCO BRADESCO PREF SA             Financials       0.6565
## 3                            AMBEV SA       Consumer Staples       0.6062
## 4         PETROLEO BRASILEIRO PREF SA                 Energy       0.4424
## 5                        VALE PREF SA              Materials       0.4165
## 6                           PETROBRAS                 Energy       0.3613
## 7             CIA VALE DO RIO DOCE SH              Materials       0.2920
## 8   ITAUSA INVESTIMENTOS ITAU PREF SA             Financials       0.2743
## 9  BMF BOVESPA BOLSA DE VALORES MERCA             Financials       0.2433
## 10                          CIELO S/A Information Technology       0.2065
## # ... with 49 more rows, and 1 more variables: `Market Value` <chr>