# NOT RUN {
# Passing a data frame to the function
mtcars %>%
download_this(
output_name = "mtcars dataset",
output_extension = ".csv",
button_label = "Download data",
button_type = "warning",
has_icon = TRUE,
icon = "fa fa-save"
)
# Passing a list with data frames to the function
list(mtcars, iris) %>%
download_this(
output_name = "mtcars and iris datasets",
output_extension = ".xlsx",
button_label = "Download data",
button_type = "warning",
has_icon = TRUE,
icon = "fa fa-save"
)
# Passing a named list with data frames to the function
list('mtcars dataset' = mtcars, 'iris dataset' = iris) %>%
download_this(
output_name = "mtcars and iris datasets",
output_extension = ".xlsx",
button_label = "Download data",
button_type = "warning",
has_icon = TRUE,
icon = "fa fa-save"
)
# Passing any R object to the function
vector_example <- 1:10
linear_model <- lm(mpg ~ gear, data = mtcars)
list(mtcars, iris, vector_example, linear_model) %>%
download_this(
output_name = "datasets, vector, and linear model",
output_extension = ".rds",
button_label = "Download as rds",
button_type = "warning",
has_icon = TRUE,
icon = "fa fa-save"
)
# }
Run the code above in your browser using DataLab