# To build this vignette run devtools::build_vignettes() # Then rebuild the package CTRL+SHIFT+B so that the vignette is # integrated to the package documentation
library(tradeflows) library(dplyr) library(ggplot2)
The package ggplot2 is used for visualisation examples below.
The documentation of each function is available by entering ?function_name
at the R prompt.
swd99 <- tradeflows::sawnwoodexample %>% filterworldeu28() %>% addregion() %>% addconversionfactorandprice() # Alternative way to load the dataset # when access to a database is available # in the code above, replace # 'tradeflows::sawnwoodexample' # by # 'readdbproduct(440799, "raw_flow_yearly")'
Lines represent large quantities which are at the same prices.
p <- ggplot(filter(swd99, price!=Inf), aes(x = tradevalue, y = price)) + geom_point(alpha = 1/5) + scale_x_log10(limits=c(1000, NA)) + xlab("Trade value $ (log scale)") + coord_cartesian(ylim =c(0,2000)) + ylab(expression("Price $/m"^"3")) + ggtitle("Variation of prices along the tradevalue") p p + facet_wrap(~flow) + aes(color=as.factor(flag))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.