View source: R/docsFileMethods.R
fileMethods | R Documentation |
These methods enable to the user to export a file stored in a project field, import a file, or delete an existing file.
exportFiles(
rcon,
record,
field,
event = NULL,
dir = getwd(),
file_prefix = TRUE,
...
)
importFiles(
rcon,
file,
record,
field,
event,
overwrite = TRUE,
repeat_instance = NULL,
...
)
deleteFiles(rcon, record, field, event, ...)
## S3 method for class 'redcapApiConnection'
exportFiles(
rcon,
record,
field,
event = NULL,
dir = getwd(),
file_prefix = TRUE,
repeat_instance = NULL,
...,
error_handling = getOption("redcap_error_handling"),
config = list(),
api_param = list()
)
## S3 method for class 'redcapApiConnection'
importFiles(
rcon,
file,
record,
field,
event = NULL,
overwrite = TRUE,
repeat_instance = NULL,
...,
error_handling = getOption("redcap_error_handling"),
config = list(),
api_param = list()
)
## S3 method for class 'redcapApiConnection'
deleteFiles(
rcon,
record = NULL,
field = NULL,
event = NULL,
repeat_instance = NULL,
...,
error_handling = getOption("redcap_error_handling"),
config = list(),
api_param = list()
)
rcon |
A |
record |
|
field |
|
event |
|
repeat_instance |
|
file |
|
overwrite |
|
dir |
|
file_prefix |
|
... |
Arguments to pass to other methods |
error_handling |
|
config |
A named |
api_param |
A named |
These functions only export, import, or delete a single file.
When exporting, the file name cannot be changed; whatever name exists in REDCap is the name that will be used. The record ID and event name may be appended as a prefix.
exportFiles
invisibly returns the file path to which the exported
file was saved.
importFiles
invisibly returns TRUE
when successful, or throws an
error if the import failed.
deleteFiles
invisible returns TRUE
when successful, or throws an
error if the deletion failed.
exportFiles()
: Export a file from a REDCap project.
importFiles()
: Import a file to a REDCap project.
deleteFiles()
: Delete a file from a REDCap project.
exportFilesMultiple()
,
importFileToRecord()
(can create a record to receive the file if it does yet exist)
## Not run:
unlockREDCap(connections = c(rcon = "project_alias"),
url = "your_redcap_url",
keyring = "API_KEYs",
envir = globalenv())
save_to_dir <- tempdir()
# Export a file
exportFiles(rcon,
record = 1,
field = "file_upload_test",
dir = save_to_dir)
# Export a file for a specific event
exportFiles(rcon,
record = 1,
field = "file_upload_test",
event = "event_1_arm_1",
dir = save_to_dir)
# Import a file
importFiles(rcon,
file = "file_to_upload.txt"
record = 1,
field = "file_upload_test")
# Delete a file
deleteFiles(rcon,
record = 1,
field = "file_upload_test")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.