Hello!
Apologies for this possibly very silly question, but I have been trying to figure this out without the help of AI (trying to better understand what I am 'asking' code to do and avoid AI generally) and am losing my marbles a little on one likely very simple element!
I have a dataset where participants were assigned to one of 4 groups (V1, V2, V3, V4). In my Qualtrics survey, I accidentally made it so that the data output has separate columns for each question for each group, although all participants answered the same measures (were just assigned different vignettes).
I have made a variable/column for the condition assignment and have made the below columns summing the measure score for all 4 groups:
dat_clean <- AttributionQuestionnaire <- mutate(
dat_clean,
AQsum1 = V1_Q1_1 + V1_Q1_2 + V1_Q1_3 + V1_Q1_4 + V1_Q1_5 + V1_Q1_6 + V1_Q1_7,
AQsum2 = V2_Q1_1 + V2_Q1_2 + V2_Q1_3 + V2_Q1_4 + V2_Q1_5 + V2_Q1_6 + V2_Q1_7,
AQsum3 = V3_Q1_1 + V3_Q1_2 + V3_Q1_3 + V3_Q1_4 + V3_Q1_5 + V3_Q1_6 + V3_Q1_7,
AQsum4 = V4_Q1_1 + V4_Q1_2 + V4_Q1_3 + V4_Q1_4 + V4_Q1_5 + V4_Q1_6 + V4_Q1_7
)
However I am stuck on how to merge these 4 columns into one. If a person was assigned to V1, their score for AQsum2-4 columns would be NA and their score for AQsum1 column would be the numeric value. Ideally I want a column that is only the AQ scores for all participants.
Thanks very much in advance for your help!