Renames tensor parameters from cmdstandr to rstan format
Source:R/stan_summaries.R
rename_params_cmdstanfile_to_rstan.RdIn cmdstan output files, tensor parameters are named with their indices at the end separated by dots, e.g. my_matrix.2.1; in rstan they are named with their indices at the end internally separated by commas and then wrapped in square brackets, e.g. my_matrix[2,1].
Examples
param_names <- c("foo", "foo.1", "foo.1.2", "foo_1.1.2.3")
rename_params_cmdstanfile_to_rstan(param_names)
#> [1] "foo" "foo[1]" "foo[1,2]" "foo_1[1,2,3]"