I would like to plot simple learning curves. My data looks like this:
id trial type choice
1 1 A 0
1 2 A 1
2 1 B 1
2 2 B 0
structure(list(id = c(2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L,
4L, 4L, 4L, 4L, 4L, 6L, 6L, 6L, 6L, 6L), trial = c(1L, 2L, 3L,
4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L,
5L), choice = c(0L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 0L,
0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L), type = structure(c(1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L), .Label = c("A", "A3", "B"), class = "factor")), row.names = c(1L,
2L, 3L, 4L, 5L, 31L, 32L, 33L, 34L, 35L, 61L, 62L, 63L, 64L,
65L, 91L, 92L, 93L, 94L, 95L), class = "data.frame")
ID, Trial and Type are integers and Choice is a factor. I would like to plot the choice the different groups have made per trial. How I imagine the graph (a 1 in the vector choice
is consider correct):
The smoothness of the curves is an exaggeration.
I would also like to know how can I do calculations by coupling groups. For example, sum all the choices of group A during trials 1 to 10.
Thank you for your help!