stan-dev/stan — pull request #26 by jrnold (2013-03-13 01:43:55+00:00)
Title: added S4 method as.mcmc.list

a followup to issue #17 (my branch had gotten out of whack with stan-dev repo).

I implemented it as a S4 method named `as.mcmc.list`, and I improved its efficiency by directly using the `stanfit` object and using `as.array`.

It works fine, but there is a problem. If `coda` is loaded **after** `rstan`, then the S3 method defined by coda, `as.mcmc.list` masks the method defined in `rstan`. It can still be called explicitly with `rstan::as.mcmc.list`.

There doesn't appear to be any way around it being awkward as an S3 or S4 method without depending on coda, which makes no sense. Maybe its better to submit code to `coda`.

Also, while digging around in the code I noticed that `as.matrix`, `as.array`, `is.array`, `dim`, and `dimnames` are all defined as S3 methods, when there are S4 methods defined in `base`. Since `stanfit` is an S4 class, I think they should be defined as S4 methods.