README.md

NZ Beech Forest Dynamics

A computationally reproducible manuscript for the Draft manucript [Davidson et al. 2020].

Manuscript conclusion

Mouse populations were not affected by stoat control during any of the four seasonal seasons of New Zealand beech forests.

Outcomes from predictions A-D did not change when rat populations were manually reduced to lower densities.

Folder layout


📦publication-repository
 ┣ 📂data  
    ...
 ┣ 📂docs 
    ...
 ┣ 📂figs
    ...
 ┣ 📂rmd
  ┣ 00-Cover-letter.Rmd
  ┣ 01-introduction.Rmd
  ┣ 03-Material-and-methods.Rmd
  ┣ 04-Results.Rmd
  ┣ 05-Discussion.Rmd
  ┣ 07-references.Rmd
 ┣ 📂vignettes
    ...
 ┣ 📂_references
  ┣ Beech-forests.bib
    ...

 ```

### Data folder `/data/`

┣ 📂data ...


### Vignettes folder `/vignettes/`

These files are additonal information and resources to help with understanding the analysis done in this publication. At them moment this folder is just a dumping ground for bits of information that were to lengthly for publication. 

> Bits of appendix can probably go into here too?

┣ 📂vignettes ┣ 00-Cover-letter.Rmd ┣ 00-wr-summary.Rmd


### Libraries used

libraries needed

source("./R/r-packages-needed.R", echo = FALSE)

require(tidyverse)

sorting out fonss

marh 2019

require(kableExtra) require(extrafont)

add font to database if needed

font_import()

sorting fonts

windowsFonts() loadfonts(device = "win")

this just simply reduces long name to "Times" as in code below

windowsFonts(Times = windowsFont("TT Times New Roman"))

----sorting-references--------------------------------------------------

citr::md_cite("./Beech-forest.bib")

bib(file = "Beech-forests.bib")

automatically create a bib database for R packages

knitr::write_bib(c(.packages(), 'bookdown', 'knitr', 'rmarkdown','tidyverse', "compareGroups", "jagsUI" ), 'packages.bib') require("dplyr") require("knitr") require("docxtools") require("citr")

myPaths <- .libPaths("C:/Program Files/R/R-3.6.2/library")

myPaths <- c(myPaths)

.libPaths(myPaths) # add new path

.libPaths()

document global rules

knitr::opts_chunk$set(comment=NA, # fig.path = "../figs/", echo=FALSE, fig.height=5, fig.width=7, message=FALSE, warning=FALSE, tidy = TRUE # , cache.extra = packageVersion('tufte') )

options(knitr.table.format = 'markdown')

options(htmltools.dir.version = FALSE)

how do I do this??

,eval = FALSE,include = FALSE

export .r code only

knitr::purl("./Davidson_2019_BeechForest.Rmd")

render draft to webpage

rmarkdown::render(input = "Davidson_2019_BeechForest.Rmd")

,

output_format = "html_document",

output_file = "Davidson_2019_t.html")

----figure themes------------

source("./R/theme_raw_fig3s.r", echo = FALSE) source("./R/davidson_2019_theme.r", echo = FALSE)


sorting out fonss

marh 2019

require(extrafont)

add font to database if needed

font_import()

sorting fonts

windowsFonts() loadfonts(device = "win")

this just simply reduces long name to "Times" as in code below

windowsFonts(Times = windowsFont("TT Times New Roman"))

----sorting-references--------------------------------------------------

citr::md_cite("./Beech-forest.bib")

bib(file = "Beech-forests.bib")

automatically create a bib database for R packages

knitr::write_bib(c(.packages(), 'bookdown', 'knitr', 'rmarkdown','tidyverse', "compareGroups", "jagsUI" ), 'packages.bib')


## Folder layout

📦publication-repository ┣ 📂data ... ┣ 📂docs ... ┣ 📂figs ... ┣ 📂rmd ┣ 00-Cover-letter.Rmd ┣ 01-introduction.Rmd ┣ 03-Material-and-methods.Rmd ┣ 04-Results.Rmd ┣ 05-Discussion.Rmd ┣ 07-references.Rmd ┣ 📂vignettes ... ┣ 📂_references ┣ Beech-forests.bib ...

```

Data folder /data/

 ┣ 📂data  
    ...

Vignettes folder /vignettes/

These files are additonal information and resources to help with understanding the analysis done in this publication. At them moment this folder is just a dumping ground for bits of information that were to lengthly for publication.

Bits of appendix can probably go into here too?

 ┣ 📂vignettes
   ┣ 00-Cover-letter.Rmd
   ┣ 00-wr-summary.Rmd
 ```

### Libraries used

libraries needed

source("./R/r-packages-needed.R", echo = FALSE)

require(tidyverse)

sorting out fonss

marh 2019

require(kableExtra) require(extrafont)

add font to database if needed

font_import()

sorting fonts

windowsFonts() loadfonts(device = "win")

this just simply reduces long name to "Times" as in code below

windowsFonts(Times = windowsFont("TT Times New Roman"))

----sorting-references--------------------------------------------------

citr::md_cite("./Beech-forest.bib")

bib(file = "Beech-forests.bib")

automatically create a bib database for R packages

knitr::write_bib(c(.packages(), 'bookdown', 'knitr', 'rmarkdown','tidyverse', "compareGroups", "jagsUI" ), 'packages.bib') require("dplyr") require("knitr") require("docxtools") require("citr")

myPaths <- .libPaths("C:/Program Files/R/R-3.6.2/library")

myPaths <- c(myPaths)

.libPaths(myPaths) # add new path

.libPaths()

document global rules

knitr::opts_chunk$set(comment=NA, # fig.path = "../figs/", echo=FALSE, fig.height=5, fig.width=7, message=FALSE, warning=FALSE, tidy = TRUE # , cache.extra = packageVersion('tufte') )

options(knitr.table.format = 'markdown')

options(htmltools.dir.version = FALSE)

how do I do this??

,eval = FALSE,include = FALSE

export .r code only

knitr::purl("./Davidson_2019_BeechForest.Rmd")

render draft to webpage

rmarkdown::render(input = "Davidson_2019_BeechForest.Rmd")

,

output_format = "html_document",

output_file = "Davidson_2019_t.html")

----figure themes------------

source("./R/theme_raw_fig3s.r", echo = FALSE) source("./R/davidson_2019_theme.r", echo = FALSE)

sorting out fonss

marh 2019

require(extrafont)

add font to database if needed

font_import()

sorting fonts

windowsFonts() loadfonts(device = "win")

this just simply reduces long name to "Times" as in code below

windowsFonts(Times = windowsFont("TT Times New Roman"))

----sorting-references--------------------------------------------------

citr::md_cite("./Beech-forest.bib")

bib(file = "Beech-forests.bib")

automatically create a bib database for R packages

knitr::write_bib(c(.packages(), 'bookdown', 'knitr', 'rmarkdown','tidyverse', "compareGroups", "jagsUI" ), 'packages.bib')




## Contents

*page here*

┣ 📂vignettes ┃ ┣ 📜00-Cover-letter.Rmd ┃ ┣ 📜00-wr-summary.Rmd ```

Short summary

coming

Chapter One \@ref(status)

An overview of the project files.

Chapter \@ref(intro)

Manuscript introduction.

Chapter \@ref(method)

Manuscript methods using Bayesian Models.

Chapter \@ref(results): Publication results for wildlife research journal.
Chapter \@ref(discussion): Results in context of pest management in NZ.
References \@ref(refs): All references for this work.

Manuscript tools

The aim of this bookdown project is to provide a working archive of code, data and manuscripts submitting in my research.

I have build this manuscript using a combination of computational methods in Ecology. In short I have compiled this book using bookdown. Here is the minimal example of a book based on R Markdown and bookdown (https://github.com/rstudio/bookdown).

Check out the website for more resources and my working notes here.

Troubleshooting

[This must be done before reproducible step below if build does not work on your local machine].

Reproducible analysis with Docker

make.R requires various packages to be installed, and may not work properly if package versions have changed.

A [Docker image is need] to run the code reproducibly. An example would be the paper I have based this structure on here.

To use it, first install docker and clone this repository.

Navigate to the cloned repository (where /path/to/repo is the path on your machine), and launch the container:

cd /path/to/repo
docker-compose up -d

Enter the container:

docker exec -it pleurosoriopsis_analysis_1 bash

Inside the container, run make.R:

Rscript make.R

You will see the targets being built by drake, and the final manuscript should be compiled at the end as ms.pdf.

When it's finished, exit the container and take it down:

exit
docker-compose down

File structure


#STandard jekyll website file structure
.
├── _config.yml
├── _data
|   └── members.yml
├── _drafts
|   ├── begin-with-the-crazy-ideas.md
|   └── on-simplicity-in-technology.md
├── _includes
|   ├── footer.html
|   └── header.html
├── _layouts
|   ├── default.html
|   └── post.html
├── _posts
|   ├── 2007-10-29-why-every-programmer-should-play-nethack.md
|   └── 2009-04-26-barcamp-boston-4-roundup.md
├── _sass
|   ├── _base.scss
|   └── _layout.scss
├── _site
├── .jekyll-metadata
└── index.html # can also be an 'index.md' with valid front matter

Future development

All code can be found in R. The drake package is used to manage the workflow. To run all analyses and generate the manuscript, simply clone this git repository and run make.R.



davan690/beech-publication-wr documentation built on March 29, 2020, 11:09 a.m.