dataUploadServer | R Documentation |
Return reactive user-uploaded or mock data after optional checks and modifications
dataUploadServer(
id,
asDT = TRUE,
removable = FALSE,
checkFun = NULL,
appdata = NULL,
checkappdata = F,
informd = NULL
)
id |
Character ID for specifying namespace, see |
asDT |
Logical flag to indicate whether data returned should be a |
removable |
Logical flag to indicate whether data upload will have "removable" feature. Defaults to FALSE. See details. |
checkFun |
Optional, a custom check function for an additional layer of checking/modifying uploaded data.
It should return a list containing message and result (result should be |
appdata |
Optional, the path of one or more files that can be mock-uploaded. See details. |
checkappdata |
Whether |
informd |
Relative path to the Rmarkdown file, whose contents will be displayed in the modal. |
At its most basic, the module returns data from shiny::fileInput
.
However, a function can be optionally integrated with the checkFun
option
to perform additional light data checking or modification operations,
making the the module more tailored for different uses and data expectations.
(For more intense processing that might involve multiple steps and/or side effects as part of a pipeline,
one should really make a specialized module and pass the data into that intermediate module
instead of using checkFun
.)
File uploads can have reset behavior by specifying the removable
parameter,
where a remove button will appear after upload, allowing data to be cleared,
after which the module returns NULL
.
Finally, it is possible to perform a mock upload of a saved dataset, triggered externally by another input, for demonstration purposes. The dataset is expected to be a .csv/.tsv file in a directory within the app directory. For instance, the relative dataset path can be "appdata/Demo.csv".
A data.table
with a "filename" attribute containing the filename without extension,
or NULL
depending on checkFun
, or NULL
if the file was cleared.
Other dataUpload functions:
dataUploadUI()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.