Description Usage Arguments Details Value Examples
Read in the raw CSV files exported from Prospect.
1 2 | read_prospect(file = "Lookups.csv", header = TRUE, sep = ",",
convert.dates = TRUE, dictionary = data.dictionary, ...)
|
file |
File to read in. |
header |
Header option (default |
sep |
Seperator used (default |
dictionary |
Dictionary object. |
dates |
A list of character strings to use as regular expressions to identify date. variables that need converting from character to string. |
Case Report Forms are stored in the Prospect Database (https://www.ctru-prospect.shef.ac.uk/) and are exported as CSV files. These need reading into R for linking because the relational structure that exists within Prospect is lost on export prior to analysis.
When using this function the _first_ file that should be converted is 'Lookups.csv' as this is the dictionary file that can be used to automatically encode all factor variables across all subsequent files.
Data frame containing the specified file with dates converted to POSIX and factors converted to with labels applied to them.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Read in the 'Lookups.csv' which is the data dictionary for all factor variables
data.dictionary <- read_prospect(file = 'Lookups.csv',
header = TRUE,
sep = ',',
convert.dates = FALSE,
dictionary = NULL)
## Now use the data dictionary to encode factor variables and convert dates
screening <- read_prospect(file = 'Screening.csv',
header = TRUE,
sep = ',',
convert.dates = TRUE,
dictionary = data.dictionary)
## You can use lapply() to read in all files in a given directory
lapply(x = list.files(pattern = ".csv"),
function = read_prospect(file = x,
header = TRUE,
sep = ',',
convert.dates = TRUE,
dictionary = data.dictionary)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.