diff --git a/R/R/REDCap_split.r b/R/R/REDCap_split.r index dbbcd49..34feca1 100644 --- a/R/R/REDCap_split.r +++ b/R/R/REDCap_split.r @@ -14,23 +14,23 @@ #' \dontrun{ #' library(RCurl) #' -#' # Get the metadata -#' result.meta <- postForm( -#' api_url, -#' token = api_token, -#' content = 'metadata', -#' format = 'json' -#' ) -#' #' # Get the records -#' result.record <- postForm( -#' uri = api_url, -#' token = api_token, +#' records <- postForm( +#' uri = api_url, # Supply your site-specific URI +#' token = api_token, # Supply your own API token #' content = 'record', #' format = 'json', #' returnFormat = 'json' #' ) #' +#' # Get the metadata +#' metadata <- postForm( +#' uri = api_url, +#' token = api_token, +#' content = 'metadata', +#' format = 'json' +#' ) +#' #' # Convert exported JSON strings into a list of data.frames #' REDCap_split(records, metadata) #' } diff --git a/R/man/REDCap_split.Rd b/R/man/REDCap_split.Rd index b895ec8..a84d994 100644 --- a/R/man/REDCap_split.Rd +++ b/R/man/REDCap_split.Rd @@ -27,23 +27,23 @@ is used to determine which fields should be included in each resultant table. \dontrun{ library(RCurl) -# Get the metadata -result.meta <- postForm( - api_url, - token = api_token, - content = 'metadata', - format = 'json' -) - # Get the records -result.record <- postForm( - uri = api_url, - token = api_token, +records <- postForm( + uri = api_url, # Supply your site-specific URI + token = api_token, # Supply your own API token content = 'record', format = 'json', returnFormat = 'json' ) +# Get the metadata +metadata <- postForm( + uri = api_url, + token = api_token, + content = 'metadata', + format = 'json' +) + # Convert exported JSON strings into a list of data.frames REDCap_split(records, metadata) }