I have a data set that deals with hr data. Each row is an employee id and the columns represent scores on questions they were asked.
I want to total the scores on all Common and Tech questions(theres 39 Common Questions and 39 Tech Questions) for each employee. Whenever I try to do this the totals column shows up with all zeros. Not sure where I went wrong.
Dat is what my data is called, code runs fine with no errors but the totals column just shows up with zero as every value. Thank you in advance! also newbie so if theres any glaring mistakes I apologize, would appreciate some links that will help me get better too! Here is the code that I wrote to try to do it.
techs<-grep("^T",rownames(dat),value=TRUE)
commons<-grep("^C",rownames(dat),value=TRUE)
type_q=rep("Common",dim(dat)[1])
type_q[techs]="Technical"
dat$totals<-rowSums(dat[,techs])+rowSums(dat[,commons])