Re: [R] Row to Column help

2009-10-04 Thread AC Del Re
> > Wonderful, Phil! Your suggestion produced the exact format I desired. > Thank you kindly, > AC Del Re > > > On Sun, Oct 4, 2009 at 2:03 PM, Phil Spector wrote: > >> AC - >> The easiest way I can think of is to create a time variable, >> so reshape will know which observation to call 1, 2

Re: [R] Row to Column help

2009-10-04 Thread Phil Spector
AC - The easiest way I can think of is to create a time variable, so reshape will know which observation to call 1, 2, or 3. data$time = unlist(sapply(split(data,data$id),function(x)1:nrow(x))) or data$time = unlist(tapply(data$id,data$id,function(x)1:length(x)) Then reshape(data,idvar=c('id

[R] Row to Column help

2009-10-04 Thread AC Del Re
Dear R Community, I am attempting to transpose a dataset from rows to columns but am stuck. I have tried using reshape() with little luck, possibly due to the categorical nature of the data. For example: id<-c(1,2,2,3,3,3) author<-c("j","k","k","l","l","l") tmt<-c("cbt","act","dbt","act","act","cb