On 8/10/12 5:00 PM, Andrew Gelman wrote:
> Bob,
> I have no problem with the explicit coercion . . . but do you mind the following?
> The full version is to write
> dat <- list (J=10, y=c(18,12,3, �. etc.
> But we have an R function that will convert list("x","y","z") to list (x=x, y=y, z=z). Or even something intermediate, e.g., you give it list(J=10,"y") and it returns list (J=10, y=y).
> It can all be in R, no need to be in Stan. But otherwise the whole list (a=a, b=b) etc. thing is a real pain in the ass and it also violates the "don't repeat code" principle.
I prefer explicit commands where things get
converted to a single data type for a function
rather than doing with R2WinBUGS did and allowing
a range of different input types, such as a vector
of strings that are implicitly read from the enviromment
or an explicit list.
This improves modularity immensely because the function
to converts environments plus mixed lists/vectors or whatever
is documented and tested separately and not part of the maintenance/testing
responsibility of the stan() function. It's another function
that's independently testing. This helps immensely with
both testing and doc modularity.
I also know it's not the R way of doing things,
and I think being idiomatic in R trumps doing things
modularly. So it's really up to the R users' judgments
here.
- Bob