Introduction
scissor
’s exportModule
export (download)
inputData, which is transformed by other scissor
’s
functions.
In this article, we’ll use scholarship dataset of datatoys
This article is based on 0.2.0 Version of scissor
Declare module
scissor
’s module assumes that used in the Shiny application.
and You can use snippet(type shinyapp
) to build very
basic shiny application.
library(shiny)
ui <- fluidPage(
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
This application will show nothing.
So let’s add exportModule
in ui.
ui <- fluidPage(
mod_exportModule_ui(
id = 'module'
)
)
also, exportModule
in server.
server <- function(input, output, session) {
mod_exportModule_server(
id = "module",
inputData = reactive(datatoys::scholarship)
)
}
So final (which is very basic) code will like this.
library(shiny)
ui <- fluidPage(
mod_exportModule_ui(
id = 'module'
)
)
server <- function(input, output, session) {
mod_exportModule_server(
id = "module",
inputData = reactive(datatoys::scholarship) # remotes::install_github('statgarten/datatoys')
)
}
shinyApp(ui, server) # run application
You should notice 3 things.
- both
id
in ui and server should be same. -
inputData
in server should be format of reactive
Structure of reorderModule
exportModule is consisted with Control Area
and below using flow.
- Declare module (we did already)
- select output format and filename (like ‘download.csv’)
- Export
Usage of reorderModule
You can select csv
, xlsx
, rda
and sqlite
.
For any issue or suggestion, please make issue in scissor’s github.