Learn R Programming

mmodely (version 0.2.5)

plot.confound.grid: Plot a grid of x y plots split by a confounder z

Description

Plot a grid of x y plots showing how a third confounding variable 'z' changes the slope

Usage

# S3 method for confound.grid
plot(x, Y='y', X='x', confounder='z', breaks=3,...)

Value

a confound grid plot

Arguments

x

a data frame

Y

the name of the column with the dependent/outcome variable

X

the name of the column with the predictor variable

confounder

the name of the column with confounding variable

breaks

number or vector of breaks to split the plots horizontally (across x)

...

other arguments passed to 'plot'

Examples

Run this code

path <- system.file("extdata","primate-example.data.csv", package="mmodely")
data <- read.csv(path, row.names=1)
data$col <- c('yellow','red')[data$nocturnal+1]

plot.confound.grid(x=data, Y='OC', X='leap.pct', confounder='mass.Kg')

Run the code above in your browser using DataLab