library(knitr) opts_knit$set(root.dir="../..") # file paths are relative to the root of the project directory library(tradeflows) library(dplyr) setdatabaseconfig(message=FALSE) db <- getOption("tradeflowsDB") DBread <- src_mysql(user=db["user"], host=db["host"], password=db["password"], dbname=db["dbname"]) rawflow <- tbl(DBread, "raw_flow_yearly")
See docs/development/MySQL.Rmd for the development history of accessing mysql.
#' Create a tbl_df object on a given table rawflow %>% group_by(productcode) %>% summarise(n = n(), tradevalue = sum(tradevalue)) %>% kable
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.