qmd4sci

quarto for scientists

https://github.com/njtierney/qmd4sci

Science Score: 41.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 8 committers (12.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.8%) to scientific vocabulary

Keywords from Contributors

book bookdown rmarkdown climate geospatial-data hack bruteforce
Last synced: 10 months ago · JSON representation ·

Repository

quarto for scientists

Basic Info
Statistics
  • Stars: 60
  • Watchers: 4
  • Forks: 13
  • Open Issues: 14
  • Releases: 0
Created over 4 years ago · Last pushed over 1 year ago
Metadata Files
Readme License Citation

README.md

Quarto for Scientists

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

This is a course on how to use Quarto, with the target audience being for scientists. This was first developed as a short workshop on rmarkdown, as the book "rmarkdown for scientists". The general structure will be the same, and it will grow and change over time as a living book.

Structure of the workshop

This online book covers more content than the workshop. Here's an example course structure for a full day's course.

| duration| topic | time | |---------|-------|-------| |30 minutes| installation | 930 |15 minutes| Why use Quarto | 945 |20 minutes| Workflow when using Quarto documents and projects | 1005 |20 minutes| Exporting Quarto documents to PDF, HTML, and Microsoft Word | 1025 |30 minutes| BREAK | 11:00 |10 minutes| Workflow and using keyboard shortcuts | 11:10 |30 minutes| Managing figures, tables, and captions | 11:40 |20 minutes| Managing equations and bibliographies | 12:00 |30 minutes| How to debug and handle common errors | 12:30 |60 minutes| BREAK | 13:30 | |30 minutes| Other quarto formats | 14:00 |30 minutes| Free time to convert your own documents into Quarto | 14:30 |60 minutes| The practice of 'getting unstuck', and reproducible examples | 15:30 |30 minutes| BREAK | 16:00 |60 minutes| Free time for discussion around other Quarto formats: websites, blogs, slides, and more!| 17:00

Learning outcomes

After completing this course, you will know how to:

  • Create your own Quarto document
  • Create figures and tables that you can reference in text, and update with - your data
  • Export your Quarto document to PDF, HTML, and Microsoft Word
  • Use keyboard shortcuts to improve workflow
  • Cite research articles and generate a bibliography

We may, depending on time, also cover the following areas: - Change the size and type of your figures - Create captions for your figures, and reference them in text - Cite research articles and generate a bibliography - Debug and handle common errors

Getting Started

See the installation chapter for details on software to be installed.

Working materials will be made available at github.com/njtierney/qmd4sci-materials.

Book

Book aims

This book aims to teach the following:

  • Getting started with your own Quarto document
    • Using Rstudio
    • Visual Studio Code
  • Improve workflow:
    • RStudio
    • Demonstrate rstudio projects
    • Using keyboard shortcuts
    • Quarto projects
  • Export your Quarto documents to PDF, HTML, and Microsoft Word
  • Better manage figures and tables
    • Reference figures and tables in text so that they dynamically update
    • Create captions for figures and tables
    • Change the size and type of figures
    • Save the figures to disk when rendering a document
  • Work with equations
    • Inline and display
    • Caption equations
    • Reference equations
  • Manage bibliographies
    • Cite articles in text
    • Generate bibliographies
    • Change bibliography styles
  • Debug and handle common errors with Quarto
  • Next steps in working with Quarto:
    • How to extend yourself to other formats, such as slides, websites, books, and more

Abstract aka "why should you read this"

For a scientific report to be completely credible, it must be reproducible. The full computational environment used to derive the results, including the data and code used for statistical analysis should be available for others to reproduce.

Quarto is a tool that allows you integrate your code, text and figures in a single file in order to make high quality, reproducible reports. A paper published with an included Quarto file and data sets can (in principle) be reproduced by anyone with a computer.

Future / extensions

Tentatively, there will also be a new part to this book, which discusses how to use Quarto in a targets pipeline. This is now my preferred way to work when starting new projects, and it draws heavily from Miles McBain's ergonomic workflow packages, tflow, fnmate, capsule, most of which are demonstrated in his blog post, "Benefits of a function-based diet (The {drake} post)".

License

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

Owner

  • Name: Nicholas Tierney
  • Login: njtierney
  • Kind: user
  • Location: lutruwita (Tasmania)
  • Company: Freelancer

|| Freelance Statistician and Research Software Engineer | PhD Statistics | Hiker | Runner | Coffee Geek ||

Citation (citations-and-styles.qmd)

# Citing Articles & Bibliography Styles

Now that you are near the end of your data analysis, you want to make sure that you've ~~plugged in the gaps of REF1 REF2 and so on~~ correctly cited the articles and software you wanted to mention.

## Overview

* **Teaching**
* **Exercises**

## Questions

* What sort of things can I cite?
* How do I manage my `.bib` file?
* How do I change the citation style?

## Objectives

* Provide a bibliography at the end of the document
* Cite articles and packages during the document
* learn how to manage citation styles

## How to cite things

Citing things in a Quarto document is straightforward, you refer to articles you want to cite using `[@article-handle]`. Here, `article-handle` matches the article handle in your `.bib` file.

This `.bib` file is referred to in the YAML of your document, under the option `bibliography: filename.bib`:

```YAML
---
title: 
author:
output: html_document
bibliography: references.bib
---
```

### What is a .bib file?

Good question. 

`.bib` is a format for storing references from the heyday of LaTeX. It contains plain text with reference information for the article. Here's an example one:

```
  @Book{ggplot2,
    author = {Hadley Wickham},
    title = {ggplot2: Elegant Graphics for Data Analysis},
    publisher = {Springer-Verlag New York},
    year = {2016},
    isbn = {978-3-319-24277-4},
    url = {http://ggplot2.org},
  }
```

### And how do I generate these .bib files?

You can use the `citation` function in R for R itself, and for specific R packages.

We can get the citation for R with:

```{r}
#| label: citation-r
citation()
```

And for ggplot2 with

```{r}
#| label: citation-ggplot
citation("ggplot2")
```

For journals or books, you'll need to get a specific .bib file. Yes, this can be a bit of a pain, but this is where you need to use a reference management software like [Zotero](https://www.zotero.org/), [Mendeley](https://www.mendeley.com/download-desktop/), [papers](https://www.papersapp.com/), or [paperpile](https://paperpile.com/). The important thing to to **use something**. These all allow you to get .bib files of your articles, which you can then placec in your `references.bib` file.
  
:::{.callout-note title="Your Turn"}

1. Using "05-qmd-bib-polish.qmd"
    1. Generate a references.bib file to place your citations
    1. Using the `citation()` function, generate citations for the packages we have used, "dplyr", "ggplot2", "gapminder", and for the R software, place these in your `references.bib` file
    1. Reference these in your document
    1. Add a final heading in your file called `#bibliography`
    1.  Cite the packages you use when you use them
      1.  hint: https://quarto.org/docs/authoring/footnotes-and-citations.html
      2.  hint: look at the names in packages.bib
1.  Tidy up the structure, provide some more words around the introduction and results
1.  Render the document

    
:::

## How to change the bibliography style

OK so now you've got your bibliography, but you now need to change it to _a specific journal format_. Luckily, this is now pretty easy. You can change your citation style from the [citation style language](https://citationstyles.org/)

Similar to how you referred to your `.bib` file with `bibliography: ref.bib`, you do something similar:

```YAML
---
title:
author:
output: html_document
bibliography: references.bib
csl: my_journal.csl
---
```

:::{.callout-note title="Your Turn"}

In "05-qmd-bib-polish.qmd":

1. select your bibliography style to be one from your favourite journal at the CSL github repo here: https://github.com/citation-style-language/styles (> 2,600 citations and counting)
1. place this in your rstudio project
1. refer to it in the YAML
1. Render your document and observe your greatness

:::

## How to move the bibliography location

The bibliography is typically placed at the end of the document, so your last heading should be something like `# References`. However, if you want to move it, place the following piece of text in the reference section. For example.

```
# Introduction

# References

::: {#refs}
:::

# Appendix
```

This is taken from [this section of the Quarto documentation](https://quarto.org/docs/authoring/footnotes-and-citations.html#bibliography-generation). Note they also state:

> If your bibliography is being generated using BibLaTeX or natbib...the bibliography will always appear at the end of the document and the #refs div will be ignored.

## How to not print / suppress the bibliography?

The bibliography can be suppressed with the YAML option `suppress-bibliography`

```
title: "document"
output: html
bibliography: file.bib
suppress-bibliography: true
```

:::{.callout-note title="Your Turn"}

In "05-qmd-bib-polish.qmd":

1. Generate a bibliography and an appendix that follows it

:::


:::{.callout-tip title="Demo: Use the Visual Editor mode of RStudio"}

Show off the citation auto-complete magic!

- search for DOIs
- search for R packages
- search pubmed/datacite/more!

:::

GitHub Events

Total
  • Issues event: 8
  • Watch event: 12
  • Delete event: 1
  • Push event: 15
  • Pull request event: 1
  • Fork event: 8
  • Create event: 1
Last Year
  • Issues event: 8
  • Watch event: 12
  • Delete event: 1
  • Push event: 15
  • Pull request event: 1
  • Fork event: 8
  • Create event: 1

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 228
  • Total Committers: 8
  • Avg Commits per committer: 28.5
  • Development Distribution Score (DDS): 0.158
Past Year
  • Commits: 15
  • Committers: 1
  • Avg Commits per committer: 15.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Nicholas Tierney n****y@g****m 192
Adam H. Sparks a****s@g****m 16
Federico Marini m****f@u****e 11
Rob J Hyndman r****n@g****m 4
Alison Presmanes Hill a****l 2
murraycadzow m****w@o****z 1
ImgBotApp I****p@g****m 1
Xirui Zhao 3****o 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 18
  • Total pull requests: 2
  • Average time to close issues: about 1 month
  • Average time to close pull requests: about 21 hours
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 0.33
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 6
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • njtierney (20)
Pull Request Authors
  • njtierney (3)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

DESCRIPTION cran
  • bookdown * imports
  • broom * imports
  • curl * imports
  • dplyr * imports
  • ggplot2 * imports
  • git2r * imports
  • here * imports
  • readr * imports
  • remotes * imports
  • rmarkdown * imports
  • spelling * suggests
.github/workflows/quarto-book-netlify.yaml actions
  • actions/checkout v2 composite
  • nwtgck/actions-netlify v1 composite
  • quarto-dev/quarto-actions/install-quarto v1 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite