This bookdown ebook Fundamentals of Data Visualization was originally created with bookdown
by its author Claus Wilke. The version here is different in the way it has been built, and can be rebuilt, even from the bare metal. The focus is reproducibility.
I have used rsuite
to make it fully reproducible and easier to knit. This ebook is, in some way, difficult to match or keep all the dependencies. Some packages will not be found in CRAN, or have newer versions in Github. To save all the package installation in the R global environment, I have chosen to create the book in an isolated environment with rsuite.
Besides, since not all good things last forever, after a package upgrade the ebook may stop building. These are all the packages required to build this ebook:
logging,
bookdown,
dviz.supp,
tidyverse,
patchwork,
ggforce,
ggrepel,
ggridges,
ggthemes,
ggmap,
ggtextures,
ggplot2movies,
ggspatial,
gridExtra,
treemapify,
hexbin,
magick,
maps,
tidybayes,
broom,
mgcv,
emmeans,
ungeviz,
gganimate,
RColorBrewer,
gapminder,
nycflights13,
forcats,
statebins,
sf,
geofacet,
tidyr,
tibble,
dplyr,
plot3D,
stringr,
lubridate,
rworldmap,
lwgeom,
rstanarm,
gifski,
transformr,
purrr
So, what I did is creating an isolated rsuite master project for the book, one where all the packages are spelled out in advance so the ebook can be rebuilt after: (i) an R re-installation, (ii) a new R version, or (iii) a full package upgrade. The book will be able to be regenerated to the CRAN snapshot at the date it was first succesfully built.
Because rsuite
allows a supervising project on top of other projects or packages, you can control the:
- date of the snapshot;
- R version under you want the book to be built;
- names of all the packages that satisfy the dependencies for the book to work;
- define a place for the source code of the package if the package is not in CRAN;
- a master project and a master package that takes care of reproducing the whole book, again and again, even after changing the operating system.
- a master environment with its own scripts and configuration files on top of projects and packages.
- depend less on
make
-
Download and install the RSuite client. Available for Linux, Mac and Windows.
-
Install the rsuite package with
rsuite install
-
Clone or download the ebook repository
-
Change to this repo folder and install the dependencies on its own isolated reproducible environment. Use
rsuite proj depsinst
-
Build the project with
rsuite proj build
-
In the terminal type this:
dataviz-rsuite$ Rscript R/build_final.R
for the final version of the book.
Warning. Do not build through RStudio. It will stop because of this error:
Quitting from lines 13365-13460 (_main.Rmd). Error: $ operator is invalid for atomic vectors
.
Or this:
dataviz-rsuite$ Rscript R/build_draft.R
- Open the file
index.html
from the folderwork/dataviz/_book_final
orwork/dataviz/_book
.
To publish this book in Github pages:
- Push the folder
./work/dataviz/_book_final
as the branchgh-pages
with thisgit
command from your terminal:
git subtree push --prefix work/dataviz/_book_final https://github.com/f0nzie/dataviz-rsuite.git gh-pages
- Activate
gh-pages
in your Github repository.
If you are building this in your own machine and own repository, change my username
f0nzie
by your own. This example assumes you are usinghttps
instead ofssh
.
- Call this version of the book website from: https://f0nzie.github.io/dataviz-rsuite/