Learn R Programming

graphics (version 3.6.2)

plot.data.frame: Plot Method for Data Frames

Description

plot.data.frame, a method for the plot generic. It is designed for a quick look at numeric data frames.

Usage

# S3 method for data.frame
plot(x, …)

Arguments

x

object of class data.frame.

further arguments to stripchart, plot.default or pairs.

Details

This is intended for data frames with numeric columns. For more than two columns it first calls data.matrix to convert the data frame to a numeric matrix and then calls pairs to produce a scatterplot matrix. This can fail and may well be inappropriate: for example numerical conversion of dates will lose their special meaning and a warning will be given.

For a two-column data frame it plots the second column against the first by the most appropriate method for the first column.

For a single numeric column it uses stripchart, and for other single-column data frames tries to find a plot method for the single column.

See Also

data.frame

Examples

Run this code
# NOT RUN {
plot(OrchardSprays[1], method = "jitter")
plot(OrchardSprays[c(4,1)])
plot(OrchardSprays)

plot(iris)
plot(iris[5:4])
plot(women)
# }

Run the code above in your browser using DataLab