Skip to contents

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. If NULL (default) the .Rmd file will be named funbiogeo_report.Rmd.

title

a character of length 1. The title of the report. If NULL (default) the title will be funbiogeo Report.

author

a character of length 1. The author(s) of the report. If NULL (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 is FALSE.

open

a logical. If TRUE (default), this file will be opened on the text editor.

Value

No return value.

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")
} # }