[R-sig-ME] Summing Across Items within a condition

Dan Brooks dan at brooksbaseball.net
Mon Mar 19 20:26:52 CET 2018


Your message formatting was lost when you sent to the list, but you can
probably just

>aggregate(Response~Participant+Week,data=mydata,FUN=sum)?

-Dan

On Mon, Mar 19, 2018 at 3:18 PM, Katherine Gordon <mnkatie at gmail.com> wrote:

> Hello all,
>
> I’m trying to restructure my data so that instead of each item having its
> own row, I have a sum of all of the responses per participant per condition
> appearing in each row. Basically, I want to create this new format because
> I want to compare and contrast what the analysis and results look like if
> you use linear mixed-models vs. traditional ANOVA analyses.
>
> So currently I have the variables Participant, Item (1-6), Week (1,2), and
> Response (correct or incorrect).
>
> The data is organized as below.
>
> Participant
>
> Item
>
> Week
>
> Response
>
> 1
>
> 1
>
> 1
>
> 1
>
> 1
>
> 2
>
> 1
>
> 0
>
> 1
>
> 3
>
> 1
>
> 1
>
> 1
>
> 4
>
> 1
>
> 0
>
> 1
>
> 5
>
> 1
>
> 0
>
> 1
>
> 6
>
> 1
>
> 0
>
> 2
>
> 1
>
> 1
>
> 0
>
> 2
>
> 2
>
> 1
>
> 1
>
> 2
>
> 3
>
> 1
>
> 1
>
> 2
>
> 4
>
> 1
>
> 1
>
> 2
>
> 5
>
> 1
>
> 1
>
> 2
>
> 6
>
> 1
>
> 0
>
> etc
>
>
>
>
>
>
>
>
> I would like the data to be organized as the following. Obviously the item
> column doesn’t need to exist, but wanted to show what I was going for.
>
> Participant
>
> Item
>
> Week
>
> Response
>
> 1
>
> 1-6
>
> 1
>
> 2
>
> 2
>
> 1-6
>
> 1
>
> 4
>
> etc
>
>
>
>
>
>
>
>
>
> Is there a way to create a new data file with the restructured format
> without having to add the responses for each participant within each
> condition myself?
>
> Thanks,
>
> Katie
>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list