a rmarkdown to generate automatic survey data reporting.
- Start with Steps 1-2 above
- Build Docker container:
docker-compose.exe build
- Start Docker container
docker-compose.exe up
- Open Jupyter Lab notebook by typing
localhost:8888/lab/
in the browser. RStudio is avaliable at port8787
.
This folder repository contains tools and templates for creating Caltrans Styled PDF or HTML factsheets in R Markdown. Despite the RMarkdown filename, you can use this to create reports with Python, R, and Julia code.
We borrow heavily from the Urban Insitute guide and repo. For more information, read Iterated fact sheets with R Markdown and Iterated PDFs with R Markdown.
Creating PDFs with R Markdown requires a LaTeX distribution. In the past, this too often meant installing and maintaining the large and clunky MiKTeX. Fortunately, Yihui Xie created TinTeX, a custom LaTeX distribution based on TeX Live that is lightweight and can be managed in R.
Submit the following code in R to install TinyTex (full instructions here):
install.packages(c("tinytex", "rmarkdown"))
tinytex::install_tinytex()
Note: If you installed MiKTeX in the past, uninstall it before installing TinyTex.
preamble.tex
contain settings and code to put R Markdown PDFs into the City of LA factsheet title.
- To build the report in an Rstudio session, open
report.Rmd
and click "knit". - To build the report from the command line, run
make report
If you a building an iterated report (ie, multiple sheets per LA City neighborhood), use the included iterate.R
.
The template (for example, simple-factsheet.Rmd) is iterated with the iterate.R
script.
iterate.R
takes an index, creates a data frame with outfile names and parameters, and iterates the template across each row of the data frame.