View source: R/new_compendium.R
new_compendium | R Documentation |
This function creates a research compendium (i.e. a predefined files/folders structure) to help user organizing files/folders to run analysis.
In addition to common R packages files/folders (see new_package()
for
further information) this function will created these following folders:
data/
: a folder to store raw data. Note that these data must never be
modified. If user want to modify them it is recommended to export new data
in outputs/
.
analyses/
: a folder to write analyses instructions, i.e. R scripts. If
user need to create R functions it is recommended to write them in the R/
folder.
outputs/
: a folder to store intermediate and final outputs generated by
the R scripts.
figures/
: a folder to store figures generated by the R scripts.
This function also creates a Make-like R file (make.R
). This file contains
two main lines:
devtools::install_deps()
: downloads the external dependencies required
by the project (an alternative to install.packages()
). Ideal for sharing;
devtools::load_all()
: loads external dependencies and R functions (an
alternative to library()
and source()
respectively).
As the user writes R scripts he/she can add the following line in this file:
source(here::here("rscripts", "script_X.R"))
. Then he/she can source the
entire make.R
to run analysis. The function add_dependencies()
can be
used to automatically add external dependencies in the DESCRIPTION
file.
It is recommended, for a better reproducibility, to call external
dependencies as pkg::fun()
or with @import
or @importFrom
in R
functions instead of using library()
.
All these files/folders are added to the .Rbuildignore
so the rest of the
project (e.g. R functions) can be used (or installed) as a R package.
new_compendium(
compendium = NULL,
license = "GPL (>= 2)",
status = NULL,
lifecycle = NULL,
contributing = TRUE,
code_of_conduct = TRUE,
vignette = FALSE,
test = FALSE,
create_repo = TRUE,
private = FALSE,
gh_check = FALSE,
codecov = FALSE,
website = FALSE,
gh_render = FALSE,
gh_citation = FALSE,
given = NULL,
family = NULL,
email = NULL,
orcid = NULL,
organisation = NULL,
renv = FALSE,
dockerfile = FALSE,
overwrite = FALSE,
quiet = FALSE
)
compendium |
A character vector specifying the folders to be created.
See |
license |
A character vector of length 1. The license to be used for
this project. Run The license can be changed later by calling |
status |
A character vector of length 1. The status of the project
according to the standard defined by the https://www.repostatus.org
project. One among This argument is used to add a badge to the This status can be added/changed later by using |
lifecycle |
A character vector of length 1. The life cycle stage of
the project according to the standard defined at
https://lifecycle.r-lib.org/articles/stages.html. One among
This argument is used to add a badge to the This stage can be added/changed later by using |
contributing |
A logical value. If |
code_of_conduct |
A logical value. If |
vignette |
A logical value. If |
test |
A logical value. If |
create_repo |
A logical value. If |
private |
A logical value. If |
gh_check |
A logical value. If If |
codecov |
A logical value. If If |
website |
A logical value. If If |
gh_render |
A logical value. If If |
gh_citation |
A logical value. If If |
given |
A character vector of length 1. The given name of the
maintainer of the package. If For further information see |
family |
A character vector of length 1. The family name of the
maintainer of the package. If For further information see |
email |
A character vector of length 1. The email address of the
maintainer of the package. If For further information see |
orcid |
A character vector of length 1. The ORCID of the maintainer of
the package. If For further information see |
organisation |
A character vector of length 1. The GitHub organisation to host the repository. If defined it will overwrite the GitHub pseudo. Default is |
renv |
A logical value. If |
dockerfile |
A logical value. If |
overwrite |
A logical value. If |
quiet |
A logical value. If |
No return value.
Other setup functions:
new_package()
,
refresh()
,
set_credentials()
## Not run:
library(rcompendium)
## Define **ONCE FOR ALL** your credentials ----
set_credentials(given = "John", family = "Doe",
email = "john.doe@domain.com",
orcid = "9999-9999-9999-9999", protocol = "ssh")
## Create an R package ----
new_compendium()
## Start adding data and developing functions and scripts ----
## ...
## Update package (documentation, dependencies, README, check) ----
refresh()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.