Learn R Programming

tidybayes (version 2.0.3)

tidy-format-translators: Translate between different tidy data frame formats for draws from distributions

Description

These functions translate tidybayes-style tidy data frames of draws to/from different tidy data frame formats (each format using a different naming scheme).

Usage

to_broom_names(data)

from_broom_names(data)

to_ggmcmc_names(data)

from_ggmcmc_names(data)

Arguments

data

A data frame to translate.

Value

A data frame with (possibly) new names in some columns, according to the translation scheme above.

Details

Function prefixed with to_ translate from the tidybayes format to another format, functions prefixed with from_ translate from that format back to the tidybayes format. Formats include:

to_broom_names() / from_broom_names():

  • .variable <-> term

  • .value <-> estimate

  • .prediction <-> .fitted

  • .lower <-> conf.low

  • .upper <-> conf.high

to_ggmcmc_names() / from_ggmcmc_names():

  • .chain <-> Chain

  • .iteration <-> Iteration

  • .variable <-> Parameter

  • .value <-> value

Examples

Run this code
# NOT RUN {
library(magrittr)

data(line, package = "coda")

line %>%
  gather_draws(alpha, beta, sigma) %>%
  median_qi() %>%
  to_broom_names()

# }

Run the code above in your browser using DataLab