Yes, we should definitely eliminate the concept of
The function name
extract is bad in R because it clashes with an
extract function in one of the hadleyverse packages. Actually, stand-alone functions in general are bad these days because there are 10000 packages to clash with and increasing by a few hundred every month.
So, I am pretty strongly in favor of
eta_draws <- fit$eta
rather than something like
eta_draws <- fit$extract("eta")
If you wanted all of the parameters, then you would be doing something with a specialization of a common generic function like
eta_draws would be a instance of a S4 type that mostly mirrors the types in the Stan language, so you can do things like transform it to the unconstrained space.
As to what shape
eta_draws is, I think it should be the same shape as in the Stan declaration, plus one additional trailing dimension that is iterations x chains. For things like convergence diagnostics, we need the ability to apply functions to the chains separately but for most things, we want to lump the chains together. Both uses are easy to accomplish in R because R is just storing it as a long numeric vector anyway and the dimensions are just metadata (attributes). So, you can get either shape without copying the values.