Skip to content

Commit

Permalink
data
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-domingue committed Dec 17, 2024
1 parent 7e6652b commit e0952ac
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions data/disgust_berger2014.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
x<-read.table("Berger and Anaki disgust scale 2014_1 tab delimeted",sep="\t",header=TRUE)
x<-x[x$Catch_response==1 & x$FILTER==1,]
#x<-x[x$Q12_Catch==4 & x$Q16_Catch==0,]
x$Q12_Catch<-x$Q16_Catch<-NULL

ii<-grep("^Q",names(x))
id<-1:nrow(x)
L<-list()
for (i in ii) L[[i]]<-data.frame(id=id,item=names(x)[i],resp=x[,i])
df<-data.frame(do.call("rbind",L))
df$resp<-ifelse(df$resp>4,NA,df$resp)
df$resp<-ifelse(df$resp==as.integer(df$resp),df$resp,NA)

x<-x[,1:5]
names(x)<-tolower(names(x))
names(x)<-paste("cov_",names(x),sep='')
x$id<-id

df<-merge(df,x)

write.csv(df,file="disgust_berger2014.csv",quote=FALSE,row.names=FALSE)

0 comments on commit e0952ac

Please sign in to comment.