deleteRecords {redcapAPI}R Documentation

Delete Records from a Project

Description

These methods enable the user to delete records from a project.

Usage

deleteRecords(
  rcon,
  records,
  arm = NULL,
  instrument = NULL,
  event = NULL,
  repeat_instance = NULL,
  delete_logging = FALSE,
  ...
)

## S3 method for class 'redcapApiConnection'
deleteRecords(
  rcon,
  records,
  arm = NULL,
  instrument = NULL,
  event = NULL,
  repeat_instance = NULL,
  delete_logging = FALSE,
  ...,
  error_handling = getOption("redcap_error_handling"),
  config = list(),
  api_param = list()
)

Arguments

rcon

A redcapConnection object.

records

character or integerish. Record ID's to be returned.

arm

integerish. the arm number of the arm in which the record(s) should be deleted. This can only be used if the project is longitudinal with more than one arm. If the arm parameter is not provided, the specified records will be deleted from all arms in which they exist. Whereas, if arm is provided, they will only be deleted from the specified arm.

instrument

character(1) Optional instrument to delete records from.

event

character(1) Optional event to delete records from.

repeat_instance

numeric(1) optional repeat instance to delete records from.

delete_logging

logical. Should the logging for this record be delete as well. Default to FALSE.

...

Arguments to pass to other methods

error_handling

character(1). One of c("error", "null"). An option for how to handle errors returned by the API. see redcapError().

config

A named list. Additional configuration parameters to pass to httr::POST(). These are appended to any parameters in rcon$config.

api_param

A named list. Additional API parameters to pass into the body of the API call. This provides users to execute calls with options that may not otherwise be supported by redcapAPI.

Value

deleteRecords invisibly returns a character value giving the number of records deleted.

See Also

exportRecords(),
importRecords(),
exportRecordsTyped()

Examples

## Not run: 
unlockREDCap(connections = c(rcon = "project_alias"), 
             url = "your_redcap_url", 
             keyring = "API_KEYs", 
             envir = globalenv())
             
# Delete records
deleteRecords(rcon, 
              records = c("1", "2"))


## End(Not run)


[Package redcapAPI version 2.9.1 Index]