ggstatsplot (version 0.0.8)

subtitle_meta_ggcoefstats: Prepare subtitle with meta-analysis results

Description

Making text subtitle for meta-analysis via linear (mixed-effects) models as implemented in the metafor package.

Usage

subtitle_meta_ggcoefstats(data, k = 2, messages = TRUE,
  output = "subtitle", ...)

Arguments

data

A dataframe. It must contain columns named estimate (corresponding estimates of coefficients or other quantities of interest) and std.error (the standard error of the regression term).

k

Number of digits after decimal point (should be an integer) (Default: k = 2).

messages

Decides whether messages references, notes, and warnings are to be displayed (Default: TRUE).

output

Character describing the desired output. If "subtitle", a formatted subtitle will be returned. The other option is to return "tidy" data frame with coefficients.

...

Additional arguments (ignored).

Examples

Run this code
# NOT RUN {
# set up
set.seed(123)
library(ggstatsplot)
library(gapminder)

# saving results from regression
df_results <- purrr::pmap(
  .l = list(
    data = list(gapminder::gapminder),
    formula = list(scale(lifeExp) ~ scale(gdpPercap)),
    grouping.vars = alist(continent),
    output = list("tidy", "glance")
  ),
  .f = groupedstats::grouped_lm
) %>%
  dplyr::full_join(x = .[[1]], y = .[[2]], by = "continent") %>%
  dplyr::filter(.data = ., term != "(Intercept)")

# making subtitle
ggstatsplot::subtitle_meta_ggcoefstats(
  data = df_results,
  k = 3,
  messages = FALSE
)

# getting tidy data frame with coefficients
ggstatsplot::subtitle_meta_ggcoefstats(
  data = df_results,
  messages = FALSE,
  output = "tidy"
)
# }

Run the code above in your browser using DataCamp Workspace