Improved example for R in README.md

This commit is contained in:
Egeler, Paul W 2018-10-15 13:46:26 -04:00
parent 35c03d637d
commit f3d9e81f05

View File

@ -229,16 +229,12 @@ REDCapRITS::REDCap_split(records, metadata)
REDCapRITS also works with the data export script (a.k.a., *syntax file*) supplied by REDCap. Here is an example of its usage:
```r
# You must set the working directory first since the REDCap data export script
# contains relative file references.
setwd("/path/to/data/")
# Run the data export script supplied by REDCap.
# This will create a data.frame of your records called 'data'
source("ExampleProject_R_2018-06-03_1700.r")
source("/path/to/data/ExampleProject_R_2018-06-03_1700.r", chdir = TRUE)
# Get the metadata
metadata <- read.csv("ExampleProject_DataDictionary_2018-06-03.csv")
metadata <- read.csv("/path/to/metadata/ExampleProject_DataDictionary_2018-06-03.csv")
# Split the tables
REDCapRITS::REDCap_split(data, metadata)