On 03/01/2013 12:53 PM, Pablo Menese wrote:
I'm performing item response theory with eRm packages
I am excluding the persons that doesn't fit in the infit/outfit persons.
for that I created a condition. then I have to create a new subset or
matrix but with the condition.
So:
ORIGINAL
matrix<-cbind(item1, item2, item3, item4)
IF I PERFORM A head(matrix)
item1 item2 item3 item4
3 2 3 1
3 1 2 4
THEN I CREATE THE LOGIC CONDITION
z<-thing==T
THEN I TRY TO CREATE THE NEW MATRIX BUT WITH THE CONDITION
matrix2<-cbind(item1[z==T], item2[z==T], item3[z==T], item4[z==T])
THE ISSUE IS THAT IF I PERFORM A head(matrix2)
I1 I2 I3 I4
3 2 3 1
3 1 2 4
The names of the columns change at all.
CAN ANYONE HELP ME TO KEEP THE SAME NAMES?
Hi Pablo,
If I understand what you are doing, you are "taking the scenic route".
Say you have a matrix of scores:
scoremat<-matrix(sample(1:4,40,TRUE),ncol=4)
and a vector specifying whether each person is in or out:
z<-sample(c(TRUE,FALSE),10,TRUE)
all you have to do is:
scoremat2<-scoremat2[z,]
Jim
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.