View source: R/util_fbs_child_v2dat_lab.R
util_fbs_child_v2dat_lab | R Documentation |
This function loads the .sav raw data file for the child visit 2 data that was collected via Qualtrics in the lab when the procedure was split due to covid and cleans the data. Cleaning the data involves: 1) extracting all variable descriptions, 2) selecting relevant data columns, 3) removing all practice events (e.g., 999) 4) re-ordering and re-name data columns 5) reformatting dates to be appropriate and computer readable: YYYY-MM-DD 6) re-calculate manual variables 7) re-ordering factor levels to start with value 0 8) random fixes to factor level names and variable descriptions
util_fbs_child_v2dat_lab(file_pattern, data_path)
file_pattern |
string with the pattern to search for to find the raw data file. The pattern must contain respondent and visit number (e.g., for files from parent visit 1, would enter 'Parent_V1'). |
data_path |
(optional) the full path to the directory where the raw Qualtrics database are saved, EXCLUDING the .sav file name (e.g., '.../b-childfoodlab_Shared/Active_Studies/RO1_Brain_Mechanisms_IRB_5357/Participant_Data/untouchedRaw/Qualtrics_Raw/'). If NOT entered, will assume the database is saved in the working directory. |
The databases MUST follow the naming convention: Child_V2_Lab_YYYY-MM-DD.sav
A list containing: 1) data: data.frame with raw, cleaned data from child visit 1 Qualtrics and 2) dict: all variable descriptions
#if in same working directory as data. Note - there is no need to add the COVID protocol (i.e., 'Home' or 'Lab') to file_pattern:
child_v2_dat_lab <- util_fbs_child_v2dat_lab('Child_V2')
## Not run:
#file_pattern must be a string. The following will not run:
child_v2_dat_lab <- util_fbs_child_v2dat_lab(Child_V2)
#file_pattern must have the respondent ('Child') and visit number ('V2'). If just enter 'Child', the script will not run because it will return multiple files for different parent visits. The following will not run:
child_v2_dat_lab <- util_fbs_child_v2dat_lab('Child')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.