repro_chunk: Reproduce Code Chunk

repro_chunkR Documentation

Reproduce Code Chunk

Description

Evaluate a chunk of code to extract Shiny inputs and reactives, replacing the inputs with the values selected by the user, and the reactives with the code bodies used to generate them.

Usage

repro_chunk(x, repro_code = Repro(), env = rlang::caller_env())

Arguments

x

shiny::reactive() object to make reproducible

repro_code

A Repro object to store calls found in x. By default it is empty, but if x is not the first call within an expression, this will have prior calls and pre-requisites that might be used in x.

env

The environment x is defined in. By default it is the environment of where reprex_reactive is called

Details

Whilst a default is provided to env, it is unlikely that this is the same environment x is defined in. This allows the top-level reprex_reactive call to pass through environments found for calls to other reactives in the chunk.

Value

A Repro object containing all the necessary code and packages to recreate the provided expression when evaluated.


shinyreprex documentation built on April 27, 2026, 9:10 a.m.