Skip to contents

Builds the downloadHandler() behind the CSV buttons of the app. The file is named after stem and today's date, such as top100-2026-10-24.csv, and written with utils::write.csv() without row names. When data or stem stop with shiny::req() or shiny::validate(), the download fails and the app keeps running.

Usage

csv_download(data, stem)

Arguments

data

Function or reactive returning the data frame to save.

stem

Start of the file name: a character string, or a function or reactive returning one.

Value

A shiny::downloadHandler(), to assign to an output.

Examples

if (FALSE) { # \dontrun{
# inside a module server, with downloadButton(ns("csv"), "CSV") in its UI:
output$csv <- crypto:::csv_download(reactive(head(mtcars)), "cars")
} # }