#Tne following shows how to create a dictionary
#first, copy the spreadsheet to the clipboard
#the spreadsheet should have multiple columns
#col 1 col 2 col 3
#item content label
#A1 Am indifferent to the feelings of others. (q_146)
#A2 Inquire about others' well-being. (q_1162
#...
# bfi.dictionary <- read.clipboard.tab() #read from the clipboard
# rownames(bfi.dictionary) <- bfi.dictionary[1] #the first column had the names
# bfi.dictionary <- bfi.dictionary[-1] #these are redundant, drop them
f5 <- fa(psychTools::bfi,5)
m <- colMeans(psychTools::bfi,na.rm=TRUE)
item.lookup(f5,m,dictionary=psychTools::bfi.dictionary[2,drop=FALSE])
#just show the item content, not the source of the items
fa.lookup(f5,dictionary=psychTools::bfi.dictionary[2])
#just show the means and the items
#use the m vector we found above
itemSort(as.matrix(m),dictionary=psychTools::bfi.dictionary[,2:3,drop=FALSE])
#show how to use lookupFromKeys
bfi.keys <-
list(agree=c("-A1","A2","A3","A4","A5"),conscientiousness=c("C1","C2","C3","-C4","-C5"),
extraversion=c("-E1","-E2","E3","E4","E5"),neuroticism=c("N1","N2","N3","N4","N5"),
openness = c("O1","-O2","O3","O4","-O5"))
bfi.over <- scoreOverlap(bfi.keys,bfi) #returns the corrected for overlap values
lookupFromKeys(bfi.keys,psychTools::bfi.dictionary,n=5, cors=bfi.over$item.cor)
#show the keying information
lookupItems("life",psychTools::spi.dictionary) #find those items with "life" in the item
Run the code above in your browser using DataLab