https://github.com/cboettig/template
:package: A template for my research projects, based on the R package structure
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
✓DOI references
Found 2 DOI reference(s) in README -
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (19.1%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
:package: A template for my research projects, based on the R package structure
Basic Info
Statistics
- Stars: 106
- Watchers: 6
- Forks: 19
- Open Issues: 2
- Releases: 0
Created about 12 years ago
· Last pushed almost 8 years ago
Metadata Files
Readme
Contributing
License
README.Rmd
---
output:
md_document:
variant: markdown_github
---
[](https://travis-ci.org/cboettig/template) [](https://coveralls.io/r/cboettig/template)
This repository provides the current template I use for new research projects.
## Why an R package structure?
Academic research isn't software development, and there are many other templates for how to organize a research project. So why follow an R package layout? Simply put, this is because the layout of an R package is familiar to a larger audience and allows me to leverage a rich array of tools that don't exist for more custom approaches.
"But"", you say, "a paper doesn't have unit tests, or documented functions! Surely that's a lot of needless overhead in doing this!?"
Exactly...
While there is certainly no need to use all the elements of a package in every research project, or even to have a package that can pass `devtools::check()` or even `devtools::install()` for it to be useful. Most generic layout advice starts sounding like an R package pretty quickly: have a directory for `data/`, a separate one for `R/` scripts, another one for the manuscript files, and so forth. [Temple Lang and Gentleman (2007)] advance the proposal for using the R package structure as a "Research Compendium," an idea that has since caught on with many others.
As a project grows in size and collaboration, having the more rigid structure offered by a package format becomes increasingly valuable. Packages can automate installation of dependencies, perform checks that changes have not broken code, and provide a modular and highly tested framework for collecting together the three essential elements: data, code, and manuscript-quality documentation, in a powerful and feature-rich environment.
[Temple Lang and Gentleman (2007)]: "http://doi.org/10.1198/106186007X178663"
## Steps to create the template
To use this template, I will usually clone this repo and just remove the `.git` record, starting off a new project accordingly. Here I document the steps used to set up this template from scratch, which permits a slightly more modular approach. If this were fully automated it would be preferable to copying, but has not yet reached that stage.
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
The template can be initialized with functions from devtools:
```{r, eval=FALSE}
devtools::install_github("hadley/devtools")
library("devtools")
```
Configure some default options for `devtools`, see `package?devtools`:
```{r, eval=FALSE}
options(devtools.name = "Carl Boettiger",
devtools.desc.author = "person('Carl', 'Boettiger', email='cboettig@gmail.com', role = c('aut', 'cre'))",
devtools.desc.license = "MIT + file LICENSE")
```
Run devtools templating tools
```{r, eval=FALSE}
setup()
use_testthat()
use_vignette("intro")
use_travis()
use_package_doc()
use_cran_comments()
use_readme_rmd()
```
Additional modifications and things not yet automated by `devtools`:
- Add the now-required LICENSE template data
- add `covr` to the suggests list
```{r, eval=FALSE}
writeLines(paste("YEAR: ", format(Sys.Date(), "%Y"), "\n",
"COPYRIGHT HOLDER: ", getOption("devtools.name"), sep=""),
con="LICENSE")
use_package("covr", "suggests")
write(
"
r_binary_packages:
- testthat
- knitr
r_github_packages:
- jimhester/covr
after_success:
- Rscript -e 'library(covr); coveralls()'",
file=".travis.yml", append=TRUE)
```
### Further steps that aren't automated
Further steps aren't yet automated in devtools or by me; as it's easier to add these manually to the template and then use the template when starting a new project.
- add the travis shield to README, (as prompted to do by `add_travis()`)
- Turn on repo at coveralls.io and add the shield to README
- adding additional dependencies to DESCRIPTION with `use_package`, and also add to `.travis.yml` manually, e.g. under `r_binary_packages:`, `r_github_packages`, or `r_packages`
- add additional data with `use_data()` or possibly `use_raw_data()` (for scripts that import and clean data first)
## Manuscript elements
- Recent developments in `rmarkdown`, `knitr` and `rticles` packages greatly faciliates using vignettes as full manuscripts. The above step adds only a basic HTML templated vignette. This package includes a template for a latex/pdf manuscript using these tools. The actual template appropriate for a project may be better selected from (possibly my fork of) the `rticles` templates.
Owner
- Name: Carl Boettiger
- Login: cboettig
- Kind: user
- Company: UC Berkeley
- Website: http://carlboettiger.info
- Repositories: 173
- Profile: https://github.com/cboettig
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Issues and Pull Requests
Last synced: over 1 year ago
All Time
- Total issues: 2
- Total pull requests: 4
- Average time to close issues: about 19 hours
- Average time to close pull requests: 14 minutes
- Total issue authors: 2
- Total pull request authors: 3
- Average comments per issue: 3.0
- Average comments per pull request: 0.25
- Merged pull requests: 3
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- jhollist (1)
- malcook (1)
Pull Request Authors
- cboettig (2)
- benmarwick (1)
- Rekyt (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
DESCRIPTION
cran
- R >= 3.1.2 depends
- gh * imports
- git2r * imports
- covr * suggests
- knitr * suggests
- testthat * suggests