Create an R Markdown Report on Site/Species/Trait Coverage with Plots
Source:R/fb_make_report.R
fb_make_report.Rd
Creates an R Markdown (.Rmd
) report from a template to explore and
summarize users data. User can modify this report and use the function
rmarkdown::render()
to convert this .Rmd
in different formats:
HTML document (
output_format = "bookdown::html_document2"
);PDF document (
output_format = "bookdown::pdf_document2"
);Word document (
output_format = "bookdown::word_document2"
);HTML, PDF and Word documents (
output_format = "all"
).
Usage
fb_make_report(
path = ".",
filename = NULL,
title = NULL,
author = NULL,
species_traits_name,
site_species_name,
site_locations_name,
overwrite = FALSE,
open = TRUE
)
Arguments
- path
a
character
of length 1. The directory in which the.Rmd
file will be created. This directory must exist.- filename
a
character
of length 1. The name of the.Rmd
file to be created. IfNULL
(default) the.Rmd
file will be namedfunbiogeo_report.Rmd
.- title
a
character
of length 1. The title of the report. IfNULL
(default) the title will befunbiogeo Report
.a
character
of length 1. The author(s) of the report. IfNULL
(default) no author will be added.- species_traits_name
a
character
of length 1. The name of the species x traits dataset (not the object). Note that before rendering the report this dataset must be loaded.- site_species_name
a
character
of length 1. The name of the sites x species dataset (not the object). Note that before rendering the report this dataset must be loaded.- site_locations_name
a
character
of length 1. The name of the sites x locations dataset (not the object). Note that before rendering the report this dataset must be loaded.- overwrite
a logical. If this file is already present and
overwrite = TRUE
, it will be erased and replaced by the template. Default isFALSE
.- open
a logical. If
TRUE
(default), this file will be opened on the text editor.
Examples
# Create temporary folder
temp_path <- tempdir()
# Load data
data("species_traits")
data("site_species")
data("site_locations")
# Create report
fb_make_report(
path = temp_path,
author = "Casajus N. and Grenié M.",
species_traits_name = "species_traits",
site_species_name = "site_species",
site_locations_name = "site_locations",
open = FALSE
)
#> The file '/tmp/RtmpW5pAUh/funbiogeo_report.Rmd' was created!
#> Open it then use knitr::knit() or rmarkdown::render() to render it.
if (FALSE) { # \dontrun{
# Open Rmd file ----
utils::file.edit(file.path(temp_path, "funbiogeo_report.Rmd"))
# Render Rmd file ----
rmarkdown::render(file.path(temp_path, "funbiogeo_report.Rmd"),
output_format = "all")
} # }