cmp: Quickie Visual Comparison

Description Usage Arguments Details Examples

Description

Quick X-Y plot to compare contents of two vectors. If vectors have row names, use that to key them for comparison.

Usage

1
cmp(a, b, xlab = "A", ylab = "B", ...)

Arguments

a

First array

b

Second array

xlab

Default x-axis label

ylab

Default y-axis label

...

Additional arguments passed to plot

Details

I constantly find myself comparing two vectors to see if they are equal. A quick X-Y plot is a great way to do this visually and is better than correlation at spotting outliers or other structure.

Usually pass two column-like things (matrices or data frames), usually keyed by row names. But can pass two list-like things (e.g. numerics) or even a two-column data frame/matrix. (Columns to the right of the first two are ignored).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x <- rnorm(50)
y <- 0.3*x^2
cmp(x, y)

x <- data.frame(x=rnorm(26), y=rnorm(26), row.names=toupper(letters))
cmp(x)

x <- data.frame(x=rnorm(26), row.names=toupper(letters))
y <- data.frame(y=rnorm(26), row.names=toupper(letters))
cmp(x, y)

pchristi99/pcLib documentation built on June 25, 2019, 2:23 p.m.