View source: R/docsRecordsMethods.R
recordsMethods | R Documentation |
These methods enable the user to export records and reports from a project.
exportRecords(
rcon,
factors = TRUE,
fields = NULL,
forms = NULL,
records = NULL,
events = NULL,
labels = TRUE,
dates = TRUE,
drop = NULL,
survey = TRUE,
dag = TRUE,
checkboxLabels = FALSE,
colClasses = character(0),
...
)
exportRecords_offline(
dataFile,
metaDataFile,
factors = TRUE,
fields = NULL,
forms = NULL,
labels = TRUE,
dates = TRUE,
checkboxLabels = FALSE,
colClasses = NA,
...,
meta_data
)
exportReports(
rcon,
report_id,
factors = TRUE,
labels = TRUE,
dates = TRUE,
drop = NULL,
checkboxLabels = FALSE,
...
)
## S3 method for class 'redcapApiConnection'
exportRecords(
rcon,
factors = TRUE,
fields = NULL,
forms = NULL,
records = NULL,
events = NULL,
labels = TRUE,
dates = TRUE,
drop = NULL,
survey = TRUE,
dag = TRUE,
checkboxLabels = FALSE,
colClasses = character(0),
...,
batch.size = -1,
form_complete_auto = TRUE
)
## S3 method for class 'redcapApiConnection'
exportReports(
rcon,
report_id,
factors = TRUE,
labels = TRUE,
dates = TRUE,
drop = NULL,
checkboxLabels = FALSE,
...
)
rcon |
A |
report_id |
|
factors |
|
fields |
|
forms |
|
records |
|
events |
|
labels |
|
dates |
|
drop |
|
survey |
|
dag |
|
checkboxLabels |
|
form_complete_auto |
|
colClasses |
Named |
batch.size |
|
dataFile |
|
metaDataFile |
|
... |
Arguments to pass to other methods |
meta_data |
Deprecated version of |
It is unnecessary to include '"redcap_event_name"“ in the fields argument. This field is automatically exported for any longitudinal database. If the user does include it in the fields argument, it is removed quietly in the parameter checks.
There are four ways the data from checkbox variables may be
represented depending on the values of factors
and
checkboxLabels
. The most common are the first and third
rows of the table below. When checkboxLabels = TRUE
, either
the coded value or the labeled value is returned if the box is
checked, or an empty string if it is not.
factors | checkboxLabels | Output |
FALSE | FALSE | 0 / 1 |
FALSE | TRUE | "" / code |
TRUE | FALSE | Unchecked / Checked |
TRUE | TRUE | "" / label |
The 'offline' version of exportReports
operates on the raw (unlabeled) data
file downloaded from REDCap along with the data dictionary.
This is made available for instances where the API cannot be accessed for
some reason (such as waiting for API approval from the REDCap administrator).
A 'batched' export (or import) is one where the export is performed over a series of
API calls rather than one large call. For large projects on small servers,
this may prevent a single user from tying up the server and forcing others
to wait on a larger job. The batched export is performed by first
calling the API to export the record identifier field (the first field
in the meta data). The unique ID's are then assigned a batch number with
no more than batch.size
ID's in any single batch. The batches are
exported from the API and stacked together.
In longitudinal projects, batch.size
may not necessarily be the
number of records exported in each batch. If batch.size
is ten and
there are four records per patient, each batch will consist of 40 records.
Thus, if the user is concerned about tying up the server with a large,
longitudinal project, it would be prudent to use a smaller batch size.
exportRecords
returns a data frame with the project data. The
data will be formatted consistent with the meta data and the arguments
provided by the user.
exportReports
returns a data frame with the data from the requested
report. The data will be formatted consisted with the meta data and
the arguments provided by the user.
exportRecords()
: Export records from a project.
exportRecords_offline()
: Format records from REDCap data file exports.
exportReports()
: Export data via a report.
exportRecordsTyped()
,
exportReportsTyped()
,
importRecords()
,
deleteRecords()
,
exportNextRecordName()
,
renameRecord()
## Not run:
unlockREDCap(connections = c(rcon = "project_alias"),
url = "your_redcap_url",
keyring = "API_KEYs",
envir = globalenv())
# Export records
exportRecords(rcon)
# Export records in batches of one hundred IDs
exportRecords(rcon,
batch.size = 100)
# Export records without factors
exportRecords(rcon,
factors = FALSE)
# Export a report
exportReports(rcon,
report_id = 12345)
# Export raw data
exportRecordsTyped(rcon,
validation = skip_validation,
cast = raw_cast)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.