Hi @stalki,
I believe you do need to keep time in there to track the changes between state and type when plotting, as otherwise the lines may overwrite and not be fully informative as in my first attempt.
I didn't really understand your suggestion with the times, so I've made something up which may or may not be helpful. You could summarise each game as a single string representing state and type (and time if that makes sense), then summarise your multiple games based on that:
library(tidyverse)
# typed in, so didn't use exactly what was supplied in terms of naming etc
stalki <- tibble(id=1:16,
game = c(1,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3),
type = c("A","B","A","C","C","A","B","C","C","C","C","B","B","B","A","A"),
state = c("s1","s1","s2","s2","s3","s1","s1","s1","s1","s2","s3","s3","s1","s2","s2","s3"),
time = c(1,2,3,4,5,1,2,3,4,5,6,7,1,2,3,4))
stalki_seq <- stalki %>%
group_by(game) %>%
summarise(seq = paste(paste0(time, 't', type, state), collapse = '>'))
stalki_seq
#> # A tibble: 3 x 2
#> game seq
#> <dbl> <chr>
#> 1 1 1tAs1>2tBs1>3tAs2>4tCs2>5tCs3
#> 2 2 1tAs1>2tBs1>3tCs1>4tCs1>5tCs2>6tCs3>7tBs3
#> 3 3 1tBs1>2tBs2>3tAs2>4tAs3
Created on 2019-03-22 by the reprex package (v0.2.1)
You may not be interested in the time, or it may be too 'variable' (cut it into groups?, round it?) for this purpose, or maybe time 1 isn't the same thing in each game. Or you may want to reduce it to times when either state or type actually changes from the previous time. But you could get to a point where you have a single string representing each game and you could then summarise all your games easily, eg:
stalki_seq %>% group_by(seq) %>% summarise(n = n())
And then you could do graphical representations of each observed game pattern, maybe with some summary info such as it's frequency, rather than each individual game. Or, groups of game patterns if that would make sense/not be too busy, with colour or size representing frequency.
@mara, @adam83, what do you reckon?