I was trying to score multiple psychological tests for a research. When trying to create a sub scale with the data I cleaned I used the following function:
dat <- subset(data, select = c(CODE, GRUPPE, ZEITPUNKT, POS, NEG,
SELBSTW, LZ, ERFOLG , MISSERFOLG , OPT , CES, RISK, CESPSYCH
,CESSOMAT, HERAUS, SHAME, SELF ))
All scales consist of numeric vectors apart from "CODE".
Fehler: Must subset columns with a valid subscript vector. x Can't convert from to due to loss of precision.
I'm really bad in R so I hope someone can help me how to solve that please
Edit:
Before I did following steps basically with all scales depending on their sub scales, need of recoding and way on scoring..:
POS <- rowMeans(data[,c("PANAS1", "PANAS3", "PANAS4","PANAS6", "PANAS10", "PANAS11", "PANAS13","PANAS15", "PANAS17", "PANAS18")])
NEG <- rowMeans(data[,c("PANAS2", "PANAS5", "PANAS7","PANAS8", "PANAS9", "PANAS12", "PANAS14","PANAS16","PANAS19", "PANAS20")])
OPT <- rowSums(data[,c("OPT1","OPT2","OPT3")])