View source: R/create_protocol.R
create_protocol | R Documentation |
This function will create a new folder based on values that are
passed on via the parameters and creates a R-markdown (bookdown) skeleton
based on a template file to start working on a new protocol.
Optionally, the rmarkdown chapters are rendered to an html file which will
be saved in a matching subfolder of the docs
folder.
create_protocol(
protocol_type = c("sfp", "spp", "sap", "sop", "sip"),
title,
short_title,
authors,
orcids,
date = Sys.Date(),
reviewers,
file_manager,
version_number = get_version_number(),
theme = NULL,
project_name = NULL,
language = c("nl", "en"),
subtitle = NULL,
from_docx = NULL,
protocol_number = NULL,
template = protocol_type,
render = FALSE
)
create_sfp(
title,
subtitle = NULL,
short_title,
authors,
orcids,
date = Sys.Date(),
reviewers,
file_manager,
version_number = get_version_number(),
theme = c("generic", "water", "air", "soil", "vegetation", "species"),
language = c("nl", "en"),
from_docx = NULL,
protocol_number = NULL,
template = c("sfp", "generic"),
render = FALSE
)
create_spp(
title,
subtitle = NULL,
short_title,
authors,
orcids,
date = Sys.Date(),
reviewers,
file_manager,
version_number = get_version_number(),
project_name,
language = c("nl", "en"),
from_docx = NULL,
protocol_number = NULL,
template = c("spp"),
render = FALSE
)
create_sap(
title,
subtitle = NULL,
short_title,
authors,
orcids,
date = Sys.Date(),
reviewers,
file_manager,
version_number = get_version_number(),
language = c("nl", "en"),
from_docx = NULL,
protocol_number = NULL,
template = c("sap", "generic"),
render = FALSE
)
create_sip(
title,
subtitle = NULL,
short_title,
authors,
orcids,
date = Sys.Date(),
reviewers,
file_manager,
version_number = get_version_number(),
language = c("nl", "en"),
from_docx = NULL,
protocol_number = NULL,
template = c("sip", "generic"),
render = FALSE
)
create_sop(
title,
subtitle = NULL,
short_title,
authors,
orcids,
date = Sys.Date(),
reviewers,
file_manager,
version_number = get_version_number(),
language = c("nl", "en"),
from_docx = NULL,
protocol_number = NULL,
template = c("sop", "generic"),
render = FALSE
)
protocol_type |
Either |
title |
A character string giving the main title of the protocol |
short_title |
A character string of less than 20 characters to use in folder and file names |
authors |
A character vector for authors of the form
|
orcids |
A character vector of |
date |
A character string of the date in ISO 8601 format ( |
reviewers |
A character vector for reviewers of the form First name Last name |
file_manager |
A character string for the name of the document maintainer of the form First name Last name |
version_number |
A version number of the form |
theme |
A character string equal to one of |
project_name |
A character string that is used as the folder location
( |
language |
Language of the protocol, either |
subtitle |
A character string for an optional subtitle |
from_docx |
A character string with the path (absolute or relative) to
a |
protocol_number |
A character string giving the protocol number.
This parameter should normally not be specified (i.e. NULL), unless
|
template |
Which template to use?
Default is set equal to protocol_type.
However, you can also set this to |
render |
Whether or not to render the protocol to html. Defaults to FALSE. |
It is assumed that the source
folder is a subfolder of an RStudio
project with git version control.
A target folder to which files will be written will be created as
subdirectories beneath source
.
The subfolder structure is of the form
/sfp/<theme>/<sfp>_<protocolnumber>_<language>_<short_title>/
for
standard field protocols.
Or /spp/<project_name>/<spp>_<protocolnumber>_<language>_<short_title>/
for standard project protocols.
Or /sip/<sip>_<protocolnumber>_<language>_<short_title>/
for sips (and
analogous for sop and sap).
The folder names are determined by the corresponding arguments of the
function.
A matching subfolder structure will be created beneath the docs
folder (and
output files needed for rendering to html output will be placed in it if
render = TRUE
.
The template Rmarkdown files and the Rmarkdown files that result from
converting a docx protocol (see from_docx
argument), will be written to
the target folder beneath source
.
Template Rmarkdown files with the same name as Rmarkdown files that result
from converting a docx protocol will be overwritten by the latter.
Besides Rmarkdown files, this target folder will also contain files needed to
render to a Bookdown gitbook
such as a _bookdown.yml
and _output.yml
.
The NEWS.md
file must be used to document the changes between revisions
of the protocol.
Furthermore, a data
and a media
folder will be created as subdirectories
of the target folder.
The media
folder can be used to store image files and will contain image
files extracted from the docx protocol when the from_docx
argument is used.
The data
folder can be used to store tabular data that are needed for the
protocol.
Other creation:
add_dependencies()
,
add_one_subprotocol()
,
add_subprotocols()
,
insert_protocolsection()
,
update_protocol()
,
update_version_number()
## Not run:
protocolhelper::create_protocol(
protocol_type = "sfp",
title = "Test 1", subtitle = "subtitle", short_title = "water 1",
authors = c("Someone, Else", "Another, One"),
orcids = c("0000-0001-2345-6789", "0000-0002-2345-6789"),
reviewers = "me", file_manager = "who?",
theme = "water", language = "en")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.