crossplot: Create a basic cross-sectional plot using standard evaluation...

Description Usage Arguments Value Examples

View source: R/crossplot.R

Description

Create a basic cross-sectional plot using standard evaluation of the variable names

Usage

1
2
3
4
crossplot(data, x.var, y.var, size.var = NULL, shapes.var = NULL,
  label.var = NULL, control.vars = NULL, title = NULL, xlabel = NULL,
  ylabel = NULL, shapes = c(1, 2, 0, 5, 6), colors = c("blue", "red",
  "darkgreen"), points.alpha = 1)

Arguments

data

the data to be plotted

x.var

string with the x axis variable

y.var

string with the y axis variable

size.var

string with the size (weighting) variable. Defaults to NULL

shapes.var

string with the shapes (different shapes for different) points variable. Defaults to NULL

label.var

string with the names of the points that can be used with geom_text or geom_text_repel

control.vars

a character vector with the names of variables that will be used as controls via the Frisch<e2><80><93>Waugh<e2><80><93>Lovell theorem. The result will be a plot (an AV Plot) and statistics where the variables in control.vars are partialed out. These variables must be present in the original dataset. Note: if control.vars is set, an attribute will be added to the returned plot and will be named control.vars

title

string with the the title for plot

xlabel

string with the xlabel. Defualts to NULL

ylabel

string with the ylabel

shapes

numeric vector with the shapes of the points. For shape options, see http://www.cookbook-r.com/Graphs/Shapes_and_line_types/

colors

character vector with the colors for different points. Defaults to c("blue", "red", "green")

points.alpha

numeric(1) indicating the alpha to be applied to the points. Default value is 1. Setting points.alpha = 0.7 is helpful when plotting labels with the points

Value

a ggplot2 plot with the cross-sectional output

Examples

1
2
3
4
5
6
7
8
data(mtcars)
crossplot(mtcars, x.var = "mpg", y.var = "hp", size.var = "wt",
          shapes.var = "cyl")
##Control for (partial out) qsec
p <- crossplot(mtcars, x.var = "hp", y.var = "mpg", size.var = "wt",
              shapes.var = "cyl", control.vars = "qsec")
print(p)
p$control.vars

ChandlerLutz/crossplotr documentation built on May 6, 2019, 9:56 a.m.