Last updated: 2020-06-12

Checks: 7 0

Knit directory: workflowr-useR2020/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2.9000). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20200611) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 28e7671. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/customization.Rmd) and HTML (docs/customization.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 43117cb John Blischak 2020-06-12 Add lesson on customization, and also customize tutorial website.

Introduction

After you’ve created your workflowr website, you may wish to customize its appearance. This lesson covers a few key methods. For the full details, please read the official vignette Customize your research website.

Change the theme

The website you created with workflowr is an rmarkdown-generated website. The rmarkdown website settings are saved in the configuration file analysis/_site.yml. The default theme applied to workflowr websites is “cosmo”. You should see the output section below that passes site-wide settings to workflowr::wflow_html(), which in turn passes these arguments to rmarkdown::html_document().

output:
  workflowr::wflow_html:
    toc: yes
    toc_float: yes
    theme: cosmo
    highlight: textmate

The available themes are from Bootswatch, but only a subset are available for use with rmarkdown:

  • cerulean
  • cosmo
  • darkly
  • flatly
  • journal
  • lumen
  • paper
  • readable
  • sandstone
  • simplex
  • spacelab
  • united
  • yeti

As an example, this workflowr website uses the theme " yeti ".

Go to Bootswatch and find a few themes you like. Then try them out by changing the value of theme in analysis/_site.yml and rebuilding one of the pages. You can either click the Knit HTML button or use wflow_build(). For convenience, choose a fast running Rmd so you can quickly explore multiple themes. Note that the updated theme will only be applied to rebuilt pages, so you’ll see the previous theme on different pages if you click around the website.

Once you’ve decided on a theme, commit the change to analysis/_site.yml while additional republishing all the Rmd files with the following command:

wflow_publish("analysis/_site.yml", "Change the theme", republish = TRUE)

Change the appearance of the workflowr buttons

You don’t have to limit yourself to the pre-made themes. If you know CSS or are willing to tinker, you can fully customize every aspect of the HTML output. You do this by specifying a custom CSS file. In the context of a workflowr project, you can create the file analysis/style.css and then add it to the output section of analysis/_site.yml. You can of course name the CSS whatever you like. The important thing is that you save it in analysis/ and specify the path relative to _site.yml.

output:
  workflowr::wflow_html:
    toc: yes
    toc_float: yes
    theme: cosmo
    highlight: textmate
    css: style.css

The workflowr buttons can be targeted with CSS class selectors. For example, to decrease the font size of the text in all the workflowr buttons, you could add the following rule:

.btn-workflowr {
  font-size: 75%;
}

You can also apply styles that are limited to specific types of workflowr buttons by using the corresponding class:

CSS class workflowr button
.btn-workflowr-report The button for the workflowr report at the top of the page
.btn-workflowr-fig The buttons for table of past versions below each figure
.btn-workflowr-sessioninfo The button for the session information at the bottom of the page

For example, to center the buttons of past versions below each figure, you could add the following rule:

.btn-workflowr-fig {
  display: block;
  margin: auto;
}

Similar to above, once you are satisfied with the changes you’ve made to the appearance, you can commit the changes and republish the webpages:

wflow_publish(c("analysis/_site.yml", "analysis/style.css"),
              "Style the workflowr buttons",
              republish = TRUE)

sessionInfo()
R version 4.0.1 (2020-06-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] workflowr_1.6.2.9000

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6         rprojroot_1.3-2      digest_0.6.25       
 [4] later_1.0.0          R6_2.4.1             backports_1.1.6     
 [7] git2r_0.27.1         magrittr_1.5         evaluate_0.14       
[10] stringi_1.4.6        rlang_0.4.6          fs_1.4.1            
[13] promises_1.1.0       whisker_0.4          rmarkdown_2.2       
[16] tools_4.0.1          stringr_1.4.0        glue_1.4.1          
[19] httpuv_1.5.2         xfun_0.14            yaml_2.2.1          
[22] compiler_4.0.1       htmltools_0.4.0.9003 knitr_1.28