collapse_vector {REDCapR} | R Documentation |
Collapse a vector of values into a single string when necessary
Description
REDCap's API frequently specifies a series of values separated by commas. In the R world, it's easier to keep these values as separate elements in a vector. This functions squashes them together in a single character element (presumably right before the return value is passed to the API)
Usage
collapse_vector(elements, collapsed)
Arguments
elements |
An array of values. Can be |
collapsed |
A single character element, where the values are separated
by commas. Can be |
Value
A single character element, where the values are separated by
commas. Can be blank. (i.e., ""
).
Author(s)
Will Beasley
Examples
library(REDCapR) #Load the package into the current R session.
REDCapR:::collapse_vector(elements=NULL, collapsed=NULL)
REDCapR:::collapse_vector(elements=letters, collapsed=NULL)
REDCapR:::collapse_vector(elements=NULL, collapsed="4,5,6")
[Package REDCapR version 1.1.0 Index]