>
> 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
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
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
3 matches
Mail list logo