scatter: Scatterplot

Description Usage Arguments Details Value Note Examples

View source: R/scatter.R

Description

Create a scatter plot between two quantitative variables.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
scatter(
  data,
  y,
  x,
  outlier = 3,
  alpha = 1,
  digits = 3,
  title,
  stats = TRUE,
  point_color = "deepskyblue2",
  outlier_color = "violetred1",
  line_color = "grey30"
)

Arguments

data

data frame

y

quantitative response variable

x

quantitative predictor variable

outlier

number. Observations with studentized residuals larger than this value are flagged. If set to 0, observations are not flagged.

alpha

Transparency of data points. A numeric value between 0 (completely transparent) and 1 (completely opaque).

digits

Number of significant digits in displayed statistics.

title

Optional title.

stats

logical. If TRUE, the slope, correlation, and correlation squared (expressed as a percentage) for the regression line are printed on the subtitle line.

point_color

Color used for points.

outlier_color

Color used to identify outliers (see the outlier parameter.

line_color

Color for regression line.

Details

The scatter function generates a scatterplot between two quantitative variables, along with a line of best fit and a 95\ By default, regression statistics (b, r, r2, p) are printed and outliers (observations with studentized residuals > 3) are flagged. Optionally, variable distributions (histograms, boxplots, violin plots, density plots) can be added to the plot margins.

Value

a ggplot2 graph

Note

Variable names do not have to be quoted.

Examples

1
scatter(cars74, hp, mpg)

Rkabacoff/eda documentation built on Dec. 18, 2021, 10:51 a.m.