Sorry for the delay. As near as I can tell from eyeballing, the source object is a list of sessions
, each of which contains a list of two elements. The first element is Result
, a status indicator such as OK
that doesn't appear needed for mockup
. The second element is Data
which consists of matchOPTA_ID
, which is something of a headfake for reasons discussed below and Players
which is a data frame object of 16 rows and 4 columns. I'm guessing that the number of columns in Players
may differ from session to session. Some of the variables appear that they might be calculated from other variables. If that is the case, I always prefer to run the calculations over again within the object that I'm creating so that I have more confidence in them.
Where it gets tricky is that ultimately the data you want to unpack are key value pairs, where the key is to be used for the variable name and the value is, well, the value. These are nested in yet another data frame structure.
After much headscratching, I found that a pairlist
is an obscure form of list that is mainly used in R
internals but can be otherwise treated as a list. I tried to eyeball creating a toy example of your data but didn't succeed. So here's a recipe without all the measures and ingredients.
Let's call your subset_session_data_list
simply l
.
names(l[1][[1]]) # may need to futz with this
gets the session number
and
l[2][2][1]
should get the PlayerName
vector and
l[2][2][4][1]
should get just a single data frame with the ultimate data, but I can't see clearly. Try it out?