Okay thank you. I will put my code below - I was using the function mutate to compute a score for specific questions of my DASS-21 questionnaire. Ideally, I am looking to calculate individual participants scores for 3 categories of the DASS-21 (depression, anxiety and stress). The numbers in the final life of code are the questions which represent the depression scale
#Dass-21
View(data)
dass21<- data %>% select(1:29)
#Assigning dass to correct columns, column 1 is participant ID
dass21 <- data[,c(1, 2:29)]
#Excluding the participants with no answers for the dass
exclude <- c(12,17,18,19,20,21,25,34,35,36,40,60,65,67,71,72,77,78,82,86,102,103,112,113,115,117,119,120,121,123,128,129,130,131)
#This includes all other participants in the dass other than those removed
dass21 <- dass21 %>% filter(!(1 %in% exclude))
#Calculating scores for depression questions (Numbers different based on R columns )
dass21 <- dass21 %>% mutate(depression = rowSums(dass21[8 + c(11,13,18,21,24,25,29)]))