Skip to content

Improve examples for parametrized reportΒ #95

@nettoyoussef

Description

@nettoyoussef

This is not an issue, but a recommendation.

I would like to suggest that in the docs available in the Rmarkdown book you include two examples in chapter 15 (parameterized reports):

  • passing parameters as raw markdown text for the parameterized reports.
  • setting the title using a parameter

This information is available in other parts of the book, but I think including them there would make easier for other people starting to create report templates.

For example, something as such in the .Rmd file:

---
output: html_document
params:
  author: author
  date: !r lubridate::today()
  set_title: title
  obs: my_text_chunk_with_markdown
title: "`r params$set_title`"  
---

This is my parameter with markdown in a chunk:

 ```{r, results='asis', echo=FALSE}
 cat(params$obs)
 ```

This is my parameter with markdown with code inline: `r paste(params$obs)`.

and something as such for the script that renders it:

rmarkdown::render(
  path_to_file,
  params = list(
                 set_title =  'title',
                 author =  'author',
                 obs = 'This is a text with *markdown* syntax.',
       ),
  output_file = 'my_report.html')
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions