Science Score: 54.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
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 9 committers (11.1%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.7%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Rmarkdown for Scientists
Basic Info
- Host: GitHub
- Owner: njtierney
- License: other
- Language: RMarkdown
- Default Branch: main
- Homepage: https://rmd4sci.njtierney.com/
- Size: 3.25 MB
Statistics
- Stars: 127
- Watchers: 7
- Forks: 43
- Open Issues: 17
- Releases: 0
Topics
Metadata Files
README.md

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
Rmarkdown for Scientists 
This is a book on rmarkdown, aimed for scientists. It was initially developed as a 3 hour workshop, but is now developed into a resource that will grow and change over time as a living book.
This book aims to teach the following:
- Getting started with your own R Markdown document
- Improve workflow:
- With rstudio projects
- Using keyboard shortcuts
- Export your R Markdown document 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 creating an rmarkdown 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 rmarkdown
- Next steps in working with rmarkdown - how to extend yourself to other rmarkdown formats
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. R Markdown 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 R Markdown file and data sets can be reproduced by anyone with a computer.
After completing this course, you will know how to:
- Create your own R Markdown document
- Create figures and tables that you can reference in text, and update with - your data
- Export your R Markdown 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
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
- Website: https://www.njtierney.com
- Repositories: 351
- Profile: https://github.com/njtierney
|| Freelance Statistician and Research Software Engineer | PhD Statistics | Hiker | Runner | Coffee Geek ||
Citation (citations-and-styles.Rmd)
# 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 an rmarkdown 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 haydey of LaTeX. It contains scripts 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 citation-r}
citation()
```
And for ggplot2 with
```{r 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 my personal preference [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.
### Your Turn {.exercise}
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. 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
---
```
### Your Turn {.exercise}
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 (> 1800 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, you need to use the `bookdown::html_document2()` output option, and then in your document, place the following piece of text in the reference section. For example.
```
# Introduction
# References {-}
<div id="refs"></div>
# Appendix
```
Note the reference section, the code: `<div id="refs"></div>`
This is taken from [this SO thread](https://stackoverflow.com/questions/51335125/adding-figures-and-tables-after-bibliography-in-rmarkdown?noredirect=1&lq=1). Note that the answer also states:
> Note: this will only work if you use pandoc's built-in citation package and won't work if you set citation_package: natbib in the YAML
### Your Turn {.exercise}
1. Generate a bibliography and an appendix that follows it
GitHub Events
Total
- Issues event: 2
- Watch event: 1
- Delete event: 1
- Issue comment event: 1
- Fork event: 3
- Create event: 1
Last Year
- Issues event: 2
- Watch event: 1
- Delete event: 1
- Issue comment event: 1
- Fork event: 3
- Create event: 1
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Nicholas Tierney | n****y@g****m | 154 |
| 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 |
| Bikram Halder | b****x@o****m | 2 |
| murraycadzow | m****w@o****z | 1 |
| Xirui Zhao | 3****o | 1 |
| ImgBotApp | I****p@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 27
- Total pull requests: 13
- Average time to close issues: about 1 month
- Average time to close pull requests: about 6 hours
- Total issue authors: 5
- Total pull request authors: 9
- Average comments per issue: 1.15
- Average comments per pull request: 1.15
- Merged pull requests: 12
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: 1 minute
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 1.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- njtierney (18)
- PatrickRobotham (5)
- adamhsparks (2)
- apreshill (1)
- LFenske (1)
Pull Request Authors
- adamhsparks (3)
- njtierney (2)
- apreshill (2)
- robjhyndman (1)
- federicomarini (1)
- xiruizhao (1)
- BikramHalder (1)
- PatrickRobotham (1)
- murraycadzow (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- bookdown * imports
- broom * imports
- curl * imports
- dplyr * imports
- ggplot2 * imports
- git2r * imports
- here * imports
- readr * imports
- remotes * imports
- rmarkdown * imports
- spelling * suggests