plot.simpleRslopes: S3 Plot Method for 'simpleRslopes' Objects

Description Usage Arguments Value Author(s) Examples

View source: R/plot.simpleRslopes.R View source: R/methods.R

Description

Plot method for simple_slopes

Usage

1
2
## S3 method for class 'simpleRslopes'
plot(x, one_plot = TRUE, ...)

Arguments

x

simpleRslopes object

one_plot

Boolean. Should one plot be printed? Defaults to TRUE

...

Additional arguments. No additional arguments available at this time

Value

Returns a list containing each plot for the simple slopes

Author(s)

Alexander Christensen <alexpaulchristensen@gmail.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Generate data
df <- data.frame(
  y = rnorm(100),
  x1 = rnorm(100),
  x2 = rnorm(100)
)

# Estimate linear model
fit <- lm(y ~ x1 * x2, data = df)

# Estimate simple slopes
result <- simple_slopes(
  fit = fit,
  variable1name = "x1", # must be name as it appears in 'fit' object
  variable2name = "x2", # must be name as it appears in 'fit' object
  plot = FALSE # only FALSE for CRAN checks
)

# Plot simple slopes
plot(result)

AlexChristensen/simpleRslopes documentation built on Feb. 6, 2022, 12:32 a.m.