Introduction to downloadthis

This package provides a wrapper around bsplus::bs_button(), which has to goal to provide a download button in HTML outputs from R Markdown without the need to have runtime: shiny.

You can easily produce a download button as follows:

Passing a data frame to the function

library(downloadthis)

mtcars %>% 
  download_this(
    output_name = "mtcars dataset",
    output_extension = ".csv",
    button_label = "Download data as csv",
    button_type = "default",
    has_icon = TRUE,
    icon = "fa fa-save"
  )

Passing a list with data frames to the function (only .xlsx supported)

list(mtcars, iris) %>%
  download_this(
    output_name = "mtcars and iris datasets",
    output_extension = ".xlsx",
    button_label = "Download datasets as xlsx",
    button_type = "warning",
    has_icon = TRUE,
    icon = "fa fa-save"
  )

Passing a named list with data frames to the function (only .xlsx supported)

list('mtcars dataset' = mtcars, 'iris dataset' = iris) %>%
  download_this(
    output_name = "mtcars and iris datasets",
    output_extension = ".xlsx",
    button_label = "Download datasets as xlsx",
    button_type = "warning",
    has_icon = TRUE,
    icon = "fa fa-save"
  )

Button types

Default

Primary

Success

Info

Warning

Danger