florianhartig / BayesianTools

General-Purpose MCMC and SMC Samplers and Tools for Bayesian Statistics
https://cran.r-project.org/web/packages/BayesianTools/index.html
115 stars 29 forks source link

getSample(whichParameters = scalar) suppresses parameter names #220

Closed twest820 closed 3 years ago

twest820 commented 3 years ago

If whichParameters isn't used, getSample()'s output has MCMC parameter names as its column names. This also seems to be the case when whichParameters is of length two or more. However, for things like whichParameters = 1, whichParameters = 5, whichParameters = c(1), and so on, the MCMC parameter name is dropped and the single column in the output is named var1. Presumably this occurs at the top level of the 0.1.7 source but it's not obvious to me how it's occurring.

Best workaround I know here is just to avoid whichParameters and use as.data.frame(getSample()) %>% select() with dplyr or some equivalent filtering outside of getSample().

florianhartig commented 3 years ago

hmm ... I guess this is the old problem with the drop behavior of R. I will have a look at that!