Git Product home page Git Product logo

computed_manuscript's Introduction

A model executable manuscript

Launch Rstudio Binder .github/workflows/knit-in-docker.yml

This repository, created to accompany an article published 28 Feb 2022 at Nature magazine, demonstrates a fully executable manuscript. The text of the manuscript is contained in the files computed_manuscript.Rmd and child_doc.Rmd; computed_manuscript.pdf, computed_manuscript.docx and computed_manuscript.html contain the documents rendered in PDF, Microsoft Word, and HTML format, respectively. (See https://observablehq.com/@jperkel/example-executable-observable-notebook for a comparable example written using Observable.)

Easy: No-installation test-drive

You can test-drive this repository without installing anything using the free and open-source Binder, which allows users to recreate computational environments in the cloud. Click the 'Launch Binder' button (Launch Rstudio Binder) to launch RStudio in your web browser, including all required libraries. (It may take a few minutes to start.)

Once RStudio is running, select computed_manuscript.Rmd from the file pane in the bottom right. Feel free to modify it, then click 'Knit' in the toolbar at the top of the main window. It will take a few minutes, as the PDF-rendering engine needs to download and install a few files, but the result will be a newly formatted version of computed_manuscript.pdf. (You can select other output formats by clicking the down-arrow next to the Knit button.)

Note: be sure to wait until the PDF-rendering step completes before attempting to open the PDF. If the 'Render' tab at the bottom of the RStudio window has a red 'stop-sign' icon at the top right, it's still working.

If you see a pop-up window saying that an external browser window failed to open, click cancel, then select computed_manuscripts.pdf in the file window at bottom right to view it.

Advanced: Try it on your own computer:

  1. 'Clone' this manuscript. From your computer's command line, execute:
git clone [email protected]:jperkel/computed_manuscript.git

Alternatively, select click the blue 'Code' button at the top of the GitHub repository to download a ZIP archive of the repository to your computer.

  1. Navigate to the manuscript directory (cd computed_manuscript).
  2. If you haven't already done so, install the R programming language and RStudio development environment.
  3. Open computed_manuscript.Rmd in RStudio.
  4. Install required packages. In the console window at the bottom of the RStudio window, execute the following command:
install.packages(c("tidyverse","bookdown","rticles","here","ggbeeswarm"))
  1. OPTIONAL: To create PDF output, you'll need LaTeX. If it's not already installed, type the following in the console window:
install.packages("tinytex")
tinytex::install_tinytex(version = "2022.01")
  1. Click the down-arrow icon immediately to the right of 'Knit' button in the toolbar at the top of the main window. Select "Knit to pdf_book", "Knit to Word" or "Knit to HMTL" to compile the Markdown file into the desired format.

Continuous integration

This repository uses the free continuous integration service GitHub Actions to ensure that changes to the manuscript do not 'break' its ability to compile to PDF. The file knit-in-docker.yml directs GitHub Actions to compile the Markdown file to PDF every time this repository changes. (You can see the result of that code-check with the 'knit-in-docker.yml' badge at the top of this README file, and also here: .github/workflows/knit-in-docker.yml) It does that by executing the Dockerfile found in the root directory of the repository. A separate Dockerfile in the .binder directory provides instructions for running this code on Binder.

Acknowledgements

Special thanks go to Ben Marwick at the University of Washington in Seattle for his tireless assistance in setting up the Binder and GitHub Actions workflows. Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.