'Rbookdown - knitting with parameters from R-Studio dropdown menu fails

I'm creating a word document using Rbookdown. I'm specifying interactive parameters in my yaml header. Everything works fine when I compile directly from the R console:

bookdown::render_book("index.Rmd", "bookdown::word_document2", params="ask")

However, when I try to use the Rstudio dropdown menu 'knitting with parameters' I get the following error:

Error in rmarkdown::render_site("C:/Users/a37880/Documents/Work/NANSEN/Surveys/SurveyReport_2021407/index.Rmd",  : 
  unused argument (params = readRDS("C:/Users/ADMINI~1/AppData/Local/Temp/RtmpWoMrht/rmdparams7b349593658.rds"))
Execution halted

My header looks like that:

---
title: "My report"
output:
  bookdown::word_document2: default
  bookdown::html_document2:
bookdown::gitbook:
  css: "style.css"
always_allow_html: true
site: bookdown::bookdown_site
params:
  repNumber:
    label: "Report number"
    value: 111
    input: numeric
  finalVersion:
    label: "Final Version"
    value: false
    input: select
    choices: [true,false]
---

My understanding is that the render_site function is failing because it does not have the 'params' argument, but I'm try to compile the word document only. If I remove the site: bookdown::bookdown_site from the header, it does runs but the compilation does not work (no word file is generated and the html contains only one header).

Any idea on what am I doing wrong?

Thanks,

P



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source