This repository contains all the data and code needed to fully reproduce the analysis and results (as well as a preprint version of the manuscript itself) of Optical Quantum Confinement in Ultrasmall ZnO and the Effect of Size on Their Photocatalytic Activity, J. Phys. Chem. C 2020, 124, 11 6395–6404 DOI: 10.1021/acs.jpcc.9b11229.
This repository was created in the spirit of collaboration and open science.
This manuscript was written with the benefit of literate programming (specifically Rnoweb) allowing the author to combine R and LaTeX code in the same document, and thus allowing data (manipulated in R) to dynamically create LaTeX tables or plots with the aid of knitr, TikZ and other R and LaTeX functionalities.
The Rnoweb structure allows us to keep the entire data ingestion and analysis within the manuscript source itself. With the addition of version tracking with git, this makes it practically impossible to sever (by failing to record metadata, etc.) the connection between the raw data and the generated analysis.
Thanks to knitr's "child" functionality, we were able to keep most of the R or LaTeX code well-separated from the text of the manuscript, thus making it easy for the authors to work with the text itself.
Part of doing science is to invite scrutiny, so, if you happen to find what you believe are errors in the data, in the analysis or in the code, please get in touch with me!.
To reproduce this manuscript yourself, you will need
- TeXLive 2021 (including siunitx v3, biblatex, biber and latexmk), and
- R v4.0.3
As a courtesy, this repo includes a very simple bash script, compile.sh
, that
demonstrates how to compile this document with knitr and latexmk (tested on Ubuntu 22.04).
The main source document is 000-paper.Rnw
(symlinked to paper.Rnw
).
This main source document includes all the other *.Rnw
files using
knitr's child mechanism.
Note that the file paper.tex
is generated, and thus overwritten every
time the document is recompiled.
Assuming you have installed the requirements listed above, you should be able to reproduce the analysis and recompile the PDF manuscript.
- Clone this repo:
$ git clone https://github.com/solarchemist/preprint-repro-jpcc2020
- Start
R
from within the manuscript directory and restore the R environment with renv:
$ cd preprint-repro-jpcc2020
$ R
> renv::restore()
Sidenote:
renv
installs all the packages specified in this project'srenv.lock
file and makes them available to this project without interfering with your system-wide R installation. Unfortunately, there is no similar software solution for LaTeX packages, so unless you opted to install the full TeXLive installation you might have some LaTeX packages you need to install manually.
- Run the provided bash script:
$ ./compile.sh
Please note that compiling the document the first time may take several minutes. Subsequent runs are much faster, thanks to the caching performed by knitr.
Note that in addition to paper.pdf
compilation also creates a stand-alone PDF of each plot
(inside the figure/
directory).
If you encounter problems with recompiling this manuscript, I'd love to hear about it!
- https://twitter.com/NatureNews/status/999715421208104960
- Before reproducibility must come preproducibility Nature 557, 613 (2018)
- How to increase reproducibility and transparency in your research Opening Reproducible Research (2019)
- Writing reproducible papers in R Tim Schoof (2019)
- Composing reproducible manuscripts using R Markdown eLife (2017)
Data is CC-BY 4.0. Code (LaTeX, R, bash) is GPL 3.0. For anything else possibly not covered by the above, consider it CC-BY 4.0.