Skip to content

Add a repair_variable_names function #317

@WardBrian

Description

@WardBrian

This allows you to translate from the names Stan uses (like theta.1) to those Posterior wants (theta[1]).

This function exists (privately) in cmdstanr, and is currently very simple:

repair_variable_names <- function(names) {
    names <- sub("\\.", "[", names)
    names <- gsub("\\.", ",", names)
    names[grep("\\[", names)] <- paste0(names[grep("\\[", names)], "]")
    names
}

This doesn't work for complex numbers or tuples, but since posterior doesn't seem to support those either I think this is fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions