knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of varsExtra is to make it easier to export vars-results.
You can install the development version of varsExtra with:
install.packages("devtools") devtools::install_github("DavZim/varsExtra")
This is a basic example which shows you how to solve a common problem:
library(varsExtra) library(vars) library(ggplot2) # set a theme for all plots theme_set(theme_light()) # load some example data and perform a VAR data(Canada) # calculate the VAR varres <- VAR(Canada, lag = 2, type = "none") # calculate an Impulse Resonse Function irfres <- irf(varres)
flatten_var(varres)
varsExtra allows you to export the results in table as well as plot format.
An easy export would look like this:
plot1 <- ggfy(varres) ggsave("myplot.pdf", plot1) table1 <- tabulize(varres, format = "latex") writeLines(table1, "mytable.tex")
var_table <- tabulize(varres, format = "latex") print(var_table)
which, when rendered looks like this

ggfy(varres)
ggfy(irfres)
Many functions have additional functionality, see the help-files for more information.
If you want need more functionality, or find a bug, you are more than welcome to open an issue or open a pull request.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.