I have the data frame df which is structured the following way:
df
.. $data1
.. .. $data12
.. .. $data13
.. $data2
.. .. $1
. . .. .. $something1
.. .. .. $something2
.. .. .. $something3
.. .. $2
.. .. .. $something1
.. .. .. $something2
.. .. .. $something3
I use: something1 <- sapply(df$data2, function(x) x$something1, USE.NAMES = FALSE)
to extract the data for each number. What I can't figure out is how to extract the number and store it as an ID for the extracted data (1 for the first dataset etc.)