Learn R Programming

visreg (version 2.7.0)

subset.visreg: Subset a visreg object

Description

Subset a visreg object so that only a portion of the full model is plotted.

Usage

# S3 method for visreg
subset(x, sub, ...)

Arguments

x

A visreg object.

sub

Logical expression indicating elements to keep, as in subset.

Not used.

Examples

Run this code
# NOT RUN {
# Fit a model and construct a visreg object
airquality$Heat <- cut(airquality$Temp,3,labels=c("Cool","Mild","Hot"))
fit <- lm(Ozone~ Solar.R + Wind*Heat,data=airquality)
v <- visreg(fit, "Wind", by="Heat", plot=FALSE)

# Plot only certain levels
vv <- subset(v, Heat %in% c("Cool", "Hot"))
plot(vv)

# Plot only up to wind 15 mph
vv <- subset(v, Wind < 15)
plot(vv)
# }

Run the code above in your browser using DataLab