Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Gabor Grothendieck
On Thu, Feb 3, 2011 at 10:05 PM, Peter Ehlers wrote: > On 2011-02-03 14:09, Dennis Murphy wrote: >> >> Hi: >> >> This also works, except that the result is of class 'table': >> >> xtabs(COUNTS ~ USER_ID + SITE, data = RAW) >>        SITE >> USER_ID SITE1 SITE2 SITE3 >>       1    10    13    22 >>

Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Peter Ehlers
On 2011-02-03 14:09, Dennis Murphy wrote: Hi: This also works, except that the result is of class 'table': xtabs(COUNTS ~ USER_ID + SITE, data = RAW) SITE USER_ID SITE1 SITE2 SITE3 1101322 2101212 31344 0 4 0 09

Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Dennis Murphy
Hi: This also works, except that the result is of class 'table': xtabs(COUNTS ~ USER_ID + SITE, data = RAW) SITE USER_ID SITE1 SITE2 SITE3 1101322 2101212 31344 0 4 0 099 If you need a data frame, then the earlier res

Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Steve Lianoglou
Hi, On Thu, Feb 3, 2011 at 2:41 PM, Mike Schumacher wrote: > Hello, > > I'd like to transpose data to create an analysis-friendly dataframe.  See > below for an example, I was unable to use t(x) and I couldn't find a > function with options like PROC TRANSPOSE in SAS. > > The ideal solution handl

Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Eik Vettorazzi
Hi Mike reshape will be your friend. reshape(RAW,direction="wide",timevar="SITE",idvar="USER_ID") there is also the 'reshape'-package, which can do some more sophisticated transformations. hth. Am 03.02.2011 20:41, schrieb Mike Schumacher: > Hello, > > I'd like to transpose data to create an

[R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Mike Schumacher
Hello, I'd like to transpose data to create an analysis-friendly dataframe. See below for an example, I was unable to use t(x) and I couldn't find a function with options like PROC TRANSPOSE in SAS. The ideal solution handles variable quantities of SITE - but beggars can't be choosers. :-) Tha