forked from ellisp/rmarkdown-corporate-eg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.R
31 lines (24 loc) · 999 Bytes
/
build.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# ./build.r
# This file downloads and munges data and builds the report/s for the project from scratch
# Peter Ellis 6 September 2017
library(rmarkdown)
library(ggplot2)
library(scales)
library(openxlsx)
library(tidyverse)
library(stringr)
library(ggseas) # for seasonal adjustment on the fly
library(forcats) # for munging factors
library(extrafont) # in case running on windows
library(stringi) # for generating pseudo lating lorem ipsum text
# Run all the files in the "R" folder, which create project assets
# like the corporate colours and the function we use to build documents.
assets <- list.files(path = "R", pattern = "\\.R$", full.names = TRUE)
created_assets <- lapply(assets, source)
rm(assets, created_assets)
# download, reshape, and save the data
source("prep/download-mrtes.R")
# load in the data (not really necessary)
load("data/mrtes.rda")
# build the actual report. Note that the build will happen in the user's home directory (~).
build_doc(subdir = "report-1")