download_server: Implement the download button.

View source: R/download.R

download_serverR Documentation

Implement the download button.

Description

The server component of the Shiny module for creating a pretty download button for downloading a csv, png, or jpg file.

Usage

download_server(id, obj, fname = "download", ftype = "csv", ...)

Arguments

id

String. The input slot that will be used to access the value.

obj

The object to be saved. Either a data frame, a blob of text, or a ggplot2 object.

fname

String. Name of the file under which to save the object.

ftype

String. Type of the file to save. One of three values: 'csv' (default), 'png', 'jpg'.

...

Arguments that can be passed into 'ggplot2::ggsave()'. For example 'dpi' (image resolution), 'width', and 'height'.

Value

A module server function that can be called in a reactive env.

See Also

download_ui for the UI.

Examples

inst/examples/ex-download.R

cabaceo/shinymod documentation built on Sept. 8, 2023, 12:23 p.m.