INVPT_D %>%
filter(SEX == "MW",
EMPSTAT == "TE",
AGE == "900000") %>%
left_join(INVPT_D_var$COUNTRY, by = "COUNTRY") %>%
group_by(COUNTRY, Country) %>%
summarise(Nobs = n(),
obsTime = last(obsTime),
obsValue = last(obsValue)) %>%
arrange(-obsValue) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(Country)),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
{if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}