mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2026-06-19 13:17:30 +02:00
Converted R code into a package
This commit is contained in:
parent
3bcc7f9482
commit
50e0496d8c
11 changed files with 154 additions and 19 deletions
53
R/man/REDCap_split.Rd
Normal file
53
R/man/REDCap_split.Rd
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/REDCap_split.r
|
||||
\name{REDCap_split}
|
||||
\alias{REDCap_split}
|
||||
\title{Split REDCap repeating instruments table into multiple tables}
|
||||
\usage{
|
||||
REDCap_split(records, metadata)
|
||||
}
|
||||
\arguments{
|
||||
\item{records}{Exported project records. May be a \code{data.frame} or
|
||||
\code{character} vector containing JSON from an API call.}
|
||||
|
||||
\item{metadata}{Project metadata (the data dictionary). May be a
|
||||
\code{data.frame} or \code{character} vector containing JSON from an API
|
||||
call.}
|
||||
}
|
||||
\value{
|
||||
A list of \code{"data.frame"}s: one base table and zero or more
|
||||
tables for each repeating instrument.
|
||||
}
|
||||
\description{
|
||||
This will take output from a REDCap export and split it into a base table
|
||||
and child tables for each repeating instrument. Metadata
|
||||
is used to determine which fields should be included in each resultant table.
|
||||
}
|
||||
\examples{
|
||||
\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,
|
||||
content = 'record',
|
||||
format = 'json',
|
||||
returnFormat = 'json'
|
||||
)
|
||||
|
||||
# Convert exported JSON strings into a list of data.frames
|
||||
REDCap_split(records, metadata)
|
||||
}
|
||||
}
|
||||
\author{
|
||||
Paul W. Egeler, M.S., GStat
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue