Re: [R] transforming a dataset for association analysis RESHAPE2

2010-11-01 Thread Ajay Ohri
I get the following message when using the reshape2 package line tDat.m- melt(Dataset) Using Item, Subject as id variables tDatCast- acast(tDat.m,Subject~Item) Aggregation function missing: defaulting to length Note Problem Statement- convert dataframe Subject Item Score 1 Subject 1 Item

Re: [R] transforming a dataset for association analysis RESHAPE2

2010-11-01 Thread Ista Zahn
Hi Ajay, I'm not sure what the problem is, and I don't think your description is enough to reproduce it. This works fine for me library(reshape2) dat - read.table(textConnection('Subject Item Score Subject 1 Item 1 1 Subject 1 Item 2 0 Subject 1 Item 3 1 Subject 2 Item 1 1

Re: [R] transforming a dataset for association analysis RESHAPE2

2010-11-01 Thread Dennis Murphy
Hi: xtabs() also works in this case: dat - read.table(textConnection('Subject Item Score + Subject 1 Item 1 1 + Subject 1 Item 2 0 + Subject 1 Item 3 1 + Subject 2 Item 1 1 + Subject 2 Item 2 1 + Subject 2 Item 3 0'), header=TRUE) closeAllConnections() acast(dat,