Welcome to the Stan forum. Unfortunately this is a known issue that hasnāt been fully resolved and may not be fixed. However, there are a few things you can try.
Thereās some code that @andrjohns shared that can be used to create the same type of structure for the posterior draws that RStan would give you, which may let you use your post-processing code:
Thereās also a guide from @brock that may be helpful:
Keeping the CmdStan CSV files fully compatible with RStan is probably not going to be a priority going forward, so I would recommend eventually writing post-processing code compatible with CmdStanR (if you want to use CmdStanR). But maybe all you need is that code from @andrjohns above? That would be the simplest thing to try. If thatās not sufficient and you end up needing to rewrite a lot your code feel free to ask for help here.
Using brms:::read_csv_as_stanfit() works and creates a stanfit object. Hopefully this function can be kept in future versions (@paul.buerkner). Thanks @jsocolar for the suggestion!
I didnāt check @brockās guide since brms already offered a simpler solution. @andrjohnsā code is also helpful for extracting posterior samples (compatible with rstan), which can simplify converting post-processing code. Thanks @jonah!
After some mostly fruitless digging through documentation and pull requests I managed to rediscover the ādraws_of() trickā to get posterior draws in the default form returned by rstan:: extract(). It seems a bit roundabout but it works without any additional packages beyond cmdstanr and posterior. Example: