ps_plot: ps_plot

View source: R/ps_plot.R

ps_plotR Documentation

ps_plot

Description

Create 2-dimensional scatter plot for one group: used by ps_2dPlot(). This is an internal function.

Usage

ps_plot(
  data,
  ps_groupVar,
  ps_byGroup,
  ps_plotAllGroups,
  useVars,
  plotPoints,
  lowessLine,
  lowess_f,
  plotMedians,
  kernelSmooth,
  kernelWidth,
  locPoly,
  plotHulls,
  plotEllipses,
  ps_ellipses,
  groupIndex,
  ps_colors,
  ps_legend,
  ps_identify
)

Arguments

data

A data frame containing the data to be analyzed

ps_groupVar

Character. Optional name of the grouping variable.

ps_byGroup

Logical. If TRUE, plots are being created by group.

ps_plotAllGroups

Logical. If TRUE, all groups are one one plot, with identifying information

useVars

A vector of length 2: the names of two analytic variables to be shown in the plots

plotPoints

Logical. If TRUE, all points are plotted; if FALSE, no points are plotted

lowessLine

Logical. If TRUE, a lowess line is plotted for each group; if FALSE, no line is plotted

lowess_f

A parameter for lowess() less than or equal to 1, defining the range of x-values used

plotMedians

Logical. If TRUE, the median value for each group is plotted with the code for the group

kernelSmooth

Logical. If TRUE, a kernel smooth is plotted for each group; if FALSE, no kernel smooth is plotted

kernelWidth

the proportion of the range of x-values used in the kernel smooth

locPoly

Logical. If TRUE, fit a local linear polynomial with a bandwidth selected using the data. Currently not used.

plotHulls

Logical. If TRUE, the convex hull is drawn for each set of points; if FALSE, no hulls are drawn

plotEllipses

Logical. If TRUE, Gaussian confidence ellipses are plotted for each group; if FALSE, no ellipses are plotted

ps_ellipses

single value or vector of values with confidence values for the ellipses

groupIndex

Integer. Used to specify the plotting character and color for multiple groups shown on one plot.

ps_colors

Character vector of plotting colors for multiple groups shown on one plot

ps_legend

Character, specifying location of legend with multiple groups shown on one plot

ps_identify

Logical. If TRUE, user can identify points of interest in the plots

Value

If the user identifies points of interest:

  • dataCheck: If ps_identify = TRUE, a data frame with the information on user-identified points of interest; value is c(NA,NA) if no points are identified

Details

This function is used internally by the function ps_2dPlot. The default values are those from ps_2dPlot. data will contain a group code, a lab ID (if used in the data set), and all analytic variables, for display if the user identifies points of interest. If plotMedians is TRUE, the convex hull and median of the points are plotted for each group. The package fANACOVA (required to use the function lowess.as()) was not available for the current version of R.


benmarwick/karon documentation built on July 29, 2023, 10:11 a.m.