[R] Help with Cast Function

2013-11-29 Thread Burhan ul haq
Hi, This is the input data frame: ### df.1 = read.table(header=T,text= id gender WMC_alcohol WMC_caffeine WMC_no.drug RT_alcohol RT_caffeine RT_no.drug 1 1 female 3.7 3.7 3.9 488 236 371 2 2 female 6.4 7.3 7.9 607 376 349 3 3 female 4.6 7.4 7.3 643 226

Re: [R] Help with Cast Function

2013-11-29 Thread Carl Witthoft
I see your desired output has rather fewer data than the input data frame. Instead of making us pore over a bunch of numbers, can you explain exactly what filtering you wish to do to get the specific subset of {male/female} {alcohol/caffeine} you're trying to get? BHM wrote Hi, This is

Re: [R] Help with Cast Function

2013-11-29 Thread David Winsemius
On Nov 29, 2013, at 9:42 AM, Burhan ul haq wrote: Hi, This is the input data frame: ### df.1 = read.table(header=T,text= id gender WMC_alcohol WMC_caffeine WMC_no.drug RT_alcohol RT_caffeine RT_no.drug 1 1 female 3.7 3.7 3.9 488 236 371 2 2

Re: [R] Help with Cast Function

2013-11-29 Thread Burhan ul haq
Hi, First, a big thanks to all those who replied. I am including all the replies in one email for easier reference later: # Input from David # reshape(df.1, idvar=1:2, sep=_, direction=long, varying=names(df.1)[3:8]) # # Input from Dennis # dfr1 - reshape(df.1, idvar = c(id, gender),