Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve examples for parametrized report #95

Open
nettoyoussef opened this issue Oct 11, 2019 · 1 comment
Open

Improve examples for parametrized report #95

nettoyoussef opened this issue Oct 11, 2019 · 1 comment

Comments

@nettoyoussef
Copy link

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')
)
@cderv
Copy link
Collaborator

cderv commented Jan 11, 2022

For reference, we have added an example about setting the title dynamically in https://bookdown.org/yihui/rmarkdown-cookbook/dynamic-yaml.html

I'll move the issue to the rmarkdown book

@cderv cderv transferred this issue from rstudio/rmarkdown Jan 11, 2022
@cderv cderv changed the title Recomendation: include example of params with markdown in the docs Improve examples for parametrized report Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants