[R] adding counter to df by group
drjimlemon at gmail.com
Thu May 4 01:21:48 CEST 2017
You wouldn't be dealing with the Stroop test, would you?
On Thu, May 4, 2017 at 4:24 AM, Davide Piffer <pifferdavide at gmail.com> wrote:
> I need to count the trials in an experiment, separately for each
> subject. I thought about using the function "by" but I could not
> manage to achieve this. Instead, I tried "split" and I got closer to a
> solution but still not getting there yet.
> The following code should create a variable "miniblock" with the
> trial/miniblock number.
> However, I get the following error message: Error in
> `$<-.data.frame`(`*tmp*`, "miniblock", value = c(1L, 2L, 3L, :
> replacement has 460 rows, data has 500
> Is there a more efficient way to achieve the result? Maybe with "by" or dplyr?
> Thanks a lot in advance!
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help