branch <- params$branch statement <- glue::glue_sql("SELECT * from customers WHERE branch == {branch}", .con = db) mydata <- DBI::dbGetQuery(conn = db, statement = statement) %>% dplyr::arrange(desc(interest_income))
final_kable <- mydata %>% dplyr::select(CIF, Customer = cust_name, `Interest Income` = interest_income) %>% dplyr::mutate('Interest Income' = scales::dollar(`Interest Income`)) %>% knitr::kable("latex", booktabs = T, longtable = T, align = c("l","r", "r")) %>% kableExtra::kable_styling( latex_options = c("scale_down"), position = "left", full_width = T ) %>% kableExtra::kable_styling(font_size = 12) final_kable
# now for a map # get state data states <- sf::st_as_sf(maps::map("state", plot = FALSE, fill = TRUE)) # combine final <- mydata %>% dplyr::left_join(states, by = c("state" = "ID"))
ggplot() + geom_sf(data = final$geom, aes(fill = final$interest_income)) + scale_fill_viridis_c(trans = "sqrt", alpha = .7) + labs(fill='Interest Income') + theme_void()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.