Re: [R] Restructure some data

2010-02-26 Thread Doran, Harold
ector(as.matrix(dat[5:7])), list(rep(dat$id,3),as.vector(as.matrix(dat[2:4]))),I) df } system.time(result <- phil(dat)) -Original Message- From: Phil Spector [mailto:spec...@stat.berkeley.edu] Sent: Thursday, February 25, 2010 5:38 PM To: Doran, Har

Re: [R] Restructure some data

2010-02-25 Thread Phil Spector
Harold - Here's what I came up with: tapply(as.vector(as.matrix(dat[5:7])), + list(rep(dat$id,3),as.vector(as.matrix(dat[2:4]))),I) item1 item10 item2 item3 item4 item5 item7 item9 1NA NA 1NANA 1NA 0 2 0 NANANANA 1 1N

[R] Restructure some data

2010-02-25 Thread Doran, Harold
Suppose I have a data frame like "dat" below. For some context, this is the format that represents student's taking a computer adaptive test. first.item is the first item that student was administered and then score.1 is the student's response to that item and so forth. item.pool <- paste("item

Re: [R] Restructure some data

2010-02-25 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Doran, Harold > Sent: Thursday, February 25, 2010 10:35 AM > To: r-help@r-project.org > Subject: [R] Restructure some data > > Suppose I have a data fra