The ttr package includes commonly used R functions for ttecon team.
# install.packages("devtools")
devtools::install_github('https://github.com/tt-econ/ttr')
library(ttr)
The production cycle is as follows:
/R. There can be no subfolders.To load for interactive testing in RStudio, use devtools:
R
# install.packages("devtools")
devtools::load_all()
Unit tests are stored in /tests/testthat (file names should start with test) with supplementary files in other subfolders of /tests. The testthat package is bundled with devtools. Comparing test figures is done using vdiffr. In RStudio:
R
# install.packages("vdiffr")
devtools::test()
For a thorough check of the package, there are two options:
In RStudio:
```R
devtools::check()
```
This will also update all documentations.
On the command line:
```bash
R CMD build [path-to-package]
R CMD check [resulting-tarball-file]
```
Code style is enforced using styler.
R
# install.packages("styler")
styler::style_pkg()
Documentation is via roxygen2, provided through devtools.
R
devtools::document()
ggplotgeom_split_violin() for a split version of geom_violin() which can be useful to compare variable distributions by group (for example, treatment and control groups)ttcolor() and ttpalette() to access ttecon colors and color palettesscale_color_tt() and scale_fill_tt() to use with ggplot()theme_tt() for figures in papers and slidesAdd the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.