Try this:

 transform(d, sequ = ave(seq(trial), trial, FUN=seq))

On Fri, Jul 10, 2009 at 10:27 AM, Jens Bölte <boelte@psy.uni-muenster.de>wrote:

> Hello,
>
> I have a data frame of the following form
>
> block trial dv
> 1 1 10
> 1 1 11
> 1 1  9
> 1 2 12
> 1 2  9
> 1 3 12
> 1 3 13
> 1 3 14
> 1 3 15
> 1 4 12
> 1 4 11
> 1 4 10
> 1 4  9
> 1 4 11
>
> and need to number the rows consecutively in the following manner
>
> block trial dv sequ
> 1 1 10 1
> 1 1 11 2
> 1 1  9 3
> 1 2 12 1
> 1 2  9 2
> 1 3 12 1
> 1 3 13 2
> 1 3 14 3
> 1 3 15 4
> 1 4 12 1
> 1 4 11 2
> 1 4 10 3
> 1 4  9 4
> 1 4 11 5
>
> Any idea how to solve this problem? I tried but did not succeed :-(
>
> Best Jens Bölte
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]


