Collect data (subsidies and landings)

# Start with subsidies for top 10 countries
subsidies <- jsonlite::fromJSON('http://api.openfisheries.org/subsidies/subsidy_country_totals.json') %>%
  arrange(-Subsidy) %>%
  head(10)

# Collect landings data
landings_dta <- sapply(subsidies$iso3c, function(x) rfisheries::of_landings(country=x) %>% filter(year == 2018) %>% select(catch)) %>% unlist()

total_catch <- data.frame(
  iso3c = subsidies$iso3c,
  landings = landings_dta
)

tbl <- subsidies %>% 
  # arrange(desc(Subsidy)) %>% head(10) %>%
  left_join(total_catch) %>%
  mutate(spkg = formattable::currency(round(Subsidy/landings/1000,2))) %>%
  select(-iso3c) %>%
  mutate(Subsidy = formattable::currency(round(Subsidy/1000000,0), digits=0)) %>%
  mutate(landings = formattable::accounting(round(landings/1000, 2), digits=0))

Format output table

kbl(tbl, col.names = c('Country', paste0('Subsidies (USD Millions)', footnote_marker_alphabet(1)), paste0('Landings (Million kg)', footnote_marker_alphabet(2)), 'Subsidy per kg'), escape = FALSE) %>%
  kable_paper("striped", full_width = F) %>%
  column_spec(2, bold = T) %>%
  row_spec(c(3, 8), bold = T, color = "white", background = "#D7261E") %>% 
  footnote(
    general = "Top 10 fishing countries by total government subsidies for the fishing industry. Korea and Canada highlighted as the only countries subsidizing more than $1/kg of fish landed.",
    alphabet = c("Source: https://doi.org/10.1016/j.dib.2019.104706", "Source: http://www.openfisheries.org/")
    )
Country Subsidies (USD Millions)a Landings (Million kg)b Subsidy per kg
China $7,261 14,831 $0.49
USA $3,429 4,757 $0.72
Korea Rep $3,185 1,345 $2.37
Japan $2,860 3,207 $0.89
Russian Federation $1,512 5,117 $0.30
Thailand $1,149 1,707 $0.67
Indonesia $936 7,261 $0.13
Canada $853 839 $1.02
Norway $846 2,658 $0.32
Spain $844 929 $0.91
Note:
Top 10 fishing countries by total government subsidies for the fishing industry. Korea and Canada highlighted as the only countries subsidizing more than $1/kg of fish landed.
a Source: https://doi.org/10.1016/j.dib.2019.104706
b Source: http://www.openfisheries.org/