Created
June 25, 2014 10:44
-
-
Save smithdanielle/68398904f1a3d4069017 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Please note, this script requires answers to be coded as "A" for agree, or "D" for disagree ### | |
AQ[,1:50]<-as.character(unlist(AQ[,1:50])) # recode to character | |
AQAnswers<-c('D','A','D','A','A','A','A','D','A','D','D','A','A','D','D','A','D','A','A','A','A','A','A','D','D','A','D','D','D','D','D','D','A','D','A','D','D','D','A','D','A','A','A','D','A','A','D','D','D','D') # create key for AQ | |
AQ<-data.frame(lapply(AQ, as.character), stringsAsFactors=FALSE) # convert df AQ to characters to enable matching by grepl | |
AQ<-as.data.frame(mapply(grepl,AQAnswers,AQ))*1 # calculate AQ score | |
# Subscales | |
AQ$AQ.socialSkill<-apply(AQ[,c(1,11,13,15,22,36,44,47:48)],1,sum) | |
AQ$AQ.attentionSwitching<-apply(AQ[,c(2,4,10,16,25,32,34,37,43,46)],1,sum) | |
AQ$AQ.attentionDetail<-apply(AQ[,c(5,6,9,12,19,23,28,29,30,49)],1,sum) | |
AQ$AQ.communication<-apply(AQ[,c(7,17,18,26,27,31,33,35,38,39)],1,sum) | |
AQ$AQ.imagination<-apply(AQ[,c(3,8,14,20,21,24,40,41,42,50)],1,sum) | |
AQ$AQ.total<-rowSums(AQ[,1:50]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment