util_fbs_merge_v5: util_fbs_merge_v5: Merge all Visit 5 raw Qualtrics databases...

View source: R/util_fbs_merge_v5.R

util_fbs_merge_v5R Documentation

util_fbs_merge_v5: Merge all Visit 5 raw Qualtrics databases and organize variable in database order

Description

This function merges the following visit 5 raw data into a single database and organizes variables in database order: child visit 5, child visit 5-home, child visit 5-lab, and parent visit 5

Usage

util_fbs_merge_v5(child_file_pattern, parent_file_pattern, data_path)

Arguments

child_file_pattern

string with the pattern to search for to find the raw child data files. The pattern must contain respondent and visit number (e.g., for files from child visit 1, would enter 'Child_V1').

parent_file_pattern

string with the pattern to search for to find the raw parent data files. 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.

Details

The databases MUST follow the naming convention: Child_V5_YYYY-MM-DD.sav, Child_V5_Home_YYY-MM-DD.sav, Child_V5_Lab_YYY-MM-DD.sav, and Parent_V5_YYY-MM-DD.sav. The databases must all be in the SAME directory to be processed if the data_path is not entered and the directory organization does not follow the structure laid out in the DataManual.

Value

A list containing: 1) data: data.frame with raw, cleaned data from parent visit 5 Qualtrics; 2) dict: all variable descriptions; 3) pna_data: data.frame marking participants who 'preferred not to answer' (pna) specific questions; and 4) pna_dict: all variable descriptions for pna_data

See Also

Raw data from Qualtrics is processed using the following scripts: util_fbs_child_v5dat, util_fbs_child_v5dat_home, util_fbs_child_v5dat_lab, util_fbs_parent_v5dat. Visit 5 data is scored using the following scripts: score_ctc, score_audit

Examples

#if in same working directory as data with all data. Note - there is no need to add the COVID protocol (i.e., 'Home' or 'Lab') to file_pattern - these files will be search for automatically:
v5dat_scored <- util_fbs_merge_v5(child_file_pattern = 'Child_V5', parent_file_pattern = 'Parent_V5')

## Not run: 
#child_file_pattern and parent_file_pattern must be a strings. The following will not run:
v5dat_scored <- util_fbs_merge_v5(child_file_pattern = Child_V5, parent_file_pattern = Parent_V5)

# *_file_pattern must have the respondent ('Child') and visit number ('V5'). If just enter 'Child' or 'Parent', the script will not run because it will return multiple files for different child visits. The following will not run:
v5dat_scored <- util_fbs_merge_v5(child_file_pattern = 'Child', parent_file_pattern = 'Parent')

## End(Not run)


alainapearce/kellertools documentation built on Feb. 25, 2024, 7:16 a.m.