effect_plot: Constructs effect plots on for cases when the response...

View source: R/plot_functions.R

effect_plotR Documentation

Constructs effect plots on for cases when the response (outcome) is a numerical variable and the explanatory (exposure) is a categorical variable.

Description

effect_plot constructs plots with error bars on which the upper and lower limits of the bars are given by the variables CI_high and CI_low, respectively.

Usage

effect_plot(data, x, y, orientation = "x")

Arguments

data

A data frame.

x

A variable in the data frame.

y

A variable in the data frame.

orientation

A string indicating the orientation of the bars.

Value

An error bars plot, for example, those to show the effects of a categorical variable on a numerical variable.

Examples

data(Fentress)
require(dplyr, quietly = TRUE)
require(sjlabelled, quietly = TRUE)

pain_cis <- Fentress |>
  gen_bst_df(pain ~ group)
names(pain_cis)[1] = "Mean"
pain_cis = pain_cis |>
  var_labels(Mean = "Pain reduction")

pain_cis |>
  effect_plot(x = Cohort, y = Mean)

pubh documentation built on Nov. 1, 2026, 9:06 a.m.