Learn R Programming

broman (version 0.98)

mypairs: My scatterplot matrix

Description

A matrix of scatterplots is produced; it's similar to graphics::pairs(), but with only the upper triangle, and call grayplot().

Usage

mypairs(x, show_na = TRUE, ...)

Value

None.

Arguments

x

A numeric matrix or data frame.

show_na

If TRUE, use grayplot_na() for the plots rather than grayplot()

...

Passed to the grayplot() function.

Details

This is like the function graphics::pairs(), but only the upper triangle is produced.

See Also

graphics::pairs(), grayplot()

Examples

Run this code
v <- rbind(c(1,0.5,0.2),c(0.5,1,0.9),c(0.2,0.9,1))
x <- rmvn(500, rep(5,3), v)
colnames(x) <- c("V1", "V2", "V3")
group_col <- sample(crayons(c("Blue","Red")), 500, repl=TRUE)
mypairs(x, pch=21, bg=group_col)

# add some missing data to the first two columns
for(i in 1:2) x[sample(500, 20),i] <- NA
mypairs(x, pch=21, bg=group_col)
mypairs(x, pch=21, bg=group_col, show_na=FALSE)
mypairs(x, pch=21, bg=group_col, force="both")

Run the code above in your browser using DataLab