What are knitr chunk options and how do parameterized R Markdown reports work?

Quick Overview

Asks what knitr chunk options control in an R Markdown document and how parameterized reports are declared and rendered. Tests practical knowledge of options such as echo, eval, include and cache, the params field in the YAML header, and rendering one report per input.

What are knitr chunk options and how do parameterized R Markdown reports work?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

What are `knitr` chunk options and how do parameterized R Markdown reports work? ```hint Two places to look Chunk behavior is set in each chunk's header, while report inputs are declared once at the top of the document. Think about what each one controls and how you would change it at render time. ``` ### What a Strong Answer Covers - What chunk options control, with the common ones for running code, showing code, output, figures and caching - Where options are set, per chunk and globally - How parameters are declared, read in code and overridden at render time - A use case such as one report per region, and how to automate it - Pitfalls when caching or rendering many reports from one session ### Follow-up Questions - How would you render one HTML file per region from a single script? - What can go wrong when you combine `cache = TRUE` with parameters? - What is the difference between `include = FALSE` and `echo = FALSE`?

Overview: Asks what knitr chunk options control in an R Markdown document and how parameterized reports are declared and rendered. Tests practical knowledge of options such as echo, eval, include and cache, the params field in the YAML header, and rendering one report per input.

General logo
General
Nov 24, 2026
easyData ScientistOtherData Manipulation (SQL/Python)
0
0

What are knitr chunk options and how do parameterized R Markdown reports work?

What a Strong Answer Covers Guidance

  • What chunk options control, with the common ones for running code, showing code, output, figures and caching
  • Where options are set, per chunk and globally
  • How parameters are declared, read in code and overridden at render time
  • A use case such as one report per region, and how to automate it
  • Pitfalls when caching or rendering many reports from one session

Follow-up Questions Guidance

  • How would you render one HTML file per region from a single script?
  • What can go wrong when you combine cache = TRUE with parameters?
  • What is the difference between include = FALSE and echo = FALSE ?