Made by Ryan Straight with APCV 302 in mind, specifically, as the focus is on using R for data analysis, this template is simple enough to fit most needs at the undergraduate level.
The actual report document being produced is an APA 6th edition document
using the papaja
package, and uses
rfordatascience/tidytuesday
code. You should also install tinytex
, of course, as per the papaja
instructions. Some demo code had been added to the script files and
dummy text to the draft.Rmd
to produce an example PDF. The
Bee Colony losses
dataset is loaded as an example. You’ll notice heavy
use of the here
package, as well.
Important: each time you knit draft.Rmd
, you will query GitHub.
There is a limit on how often you can do this. Manually downloading the
data into the /data/raw
folder and loading from there will get around
this.
An example of how to do this is to remove the tidytuesdayR
data
loading line from munge.R
. Instead, simply run this in the console:
download.file('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-01-11/colony.csv', here("data", "raw", "colony.csv"))
Then, your data load in munge.R
would be as such and you needn’t worry
about loading from GitHub:
colony <- readr::read_csv(here("data", "raw", "colony.csv'))
- Make your copy of the contributor’s
template
and complete as needed. Ensure your spreadsheet’s permissions are
set to
Anyone with the link can view
. - Place that URL in step 2 of the tenzing Shiny app. (You can use this spreadsheet as a demonstration if you like.)
- Choose
Show papaja YAML
in Step 3. - Replace the
author
andaffiliation
frontmatter in thedraft.Rmd
file with this new YAML.
The resultant report from this project is /docs/draft.pdf
by default.
The papaja
document, /docs/draft.Rmd
, has a variety of comments and
instructions within as comments. These are general suggestions that
follow a generic research paper structure.
This is the default structure for a project. It’s very basic and you should feel welcome to alter it to your liking.
project-template/
├─ data/
│ ├─ raw/ # Store raw data here, if needed
│ ├─ tidy/ # Cleaned or altered data files go here
├─ docs/
│ ├─ draft.pdf # Knitted papaja PDF
│ ├─ draft.Rmd # papaja draft document
│ ├─ refs.bib # Put your references here in BibTeX format
│ ├─ r-references.bib# Packages used in document. Generated by papaja.
├─ media/ # Non-generated figures, images, media go here
├─ src/
│ ├─ eda.R # exploratory data analysis scripts
│ ├─ plots.R # Plots, figures, graphs, et cetera
│ ├─ munge.R # Any scripts used on raw data
├─ .gitignore # Keeps certain files from being seen by GitHub
├─ .Rbuildignore # List of files to be ignored by R building
├─ project.Rproj # R project file
├─ LICENSE.md # Identifies CC-BY license for project template
├─ README.Rmd # README RMarkdown file. Edit this file.
├─ README.md # ...not this one.