Mass Regression Plot

Share:

Description

This function takes in a dataframe, the dependent variable, and optionally a character vector of independent variables you want the function to ignore, and produces a regression plot of every variable compared to the dependent variable passed into the function. It will ignore columns which contain characters and (also optional) factors.

Usage

1
2
massregplot(data, dv.var, ignore = NULL, save = NULL,
  include.factors = FALSE, include.se = TRUE)

Arguments

data

data.frame object that contains both the dependent variable and predictor variables you want to plot.

dv.var

single dependent variable you want to plot your predictors against.

ignore

accepts a character vector of one or more variables you want the function to skip. If nothing is passed through this option, the function will attempt to create a graph plotting the dependent variable and every other column of data.

save

accepts a character. If the function recieves a character, it will create a pdf file with that name and leave the plots in there.

include.factors

if TRUE, will also plot factor variables against your dv. Otherwise it will skip these as regression plots of categorical variables are of imited use.

include.se

if left TRUE, will shade the area around the regression line with the 95% confidence interval range. Setting to FALSE will plot only the regression line to a scatter plot for each paring of variables.

Value

Doesn't return a value, per se, but will generate side effects like plotting all the graphs created by the function. If the save option is used, it will save all generated graphs to a pdf file whose name is specified by the user.

Examples

1
2
3
exam.df <- iris
massregplot(exam.df, "Sepal.Length", ignore = "Species")
massregplot(exam.df, "Sepal.Length", ignore = c("Species", "Petal.Width"), include.se = FALSE)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.