Learn R Programming

MSG (version 0.8)

cut_plot: Cut the points in a scatter plot into groups according to x-axis

Description

This function can categorize the variable on the x-axis into groups and plot the mean values of y. The purpose is to show the arbitrariness of the discretization of data.

Usage

cut_plot(x, y, breaks, ..., pch.cut = 20)

Arguments

x

the x variable

y

the y variable

breaks

the breaks to cut the x variable

...

other arguments to be passed to plot.default

pch.cut

the point symbol to denote the mean values of y

Examples

Run this code
# NOT RUN {
x = rnorm(100)
y = rnorm(100)
cut_plot(x, y, seq(min(x), max(x), length = 5))
# }

Run the code above in your browser using DataLab