ps_pairsPlot: ps_pairsPlot

View source: R/ps_pairsPlot.R

ps_pairsPlotR Documentation

ps_pairsPlot

Description

Pairs plots of specified analytic values, by specified groups

Usage

ps_pairsPlot(
  doc = "ps_pairsPlot",
  data,
  GroupVar,
  Groups,
  AnalyticVars,
  Span = 2/3
)

Arguments

doc

A string documenting use added to the output list, default is the function name

data

A matrix or data frame containing the data to be analyzed

GroupVar

The name for variable defining grouping (required)

Groups

A vector of values of group variable for which plots are to be done; if "All": use all groups; if " ": no grouping

AnalyticVars

A vector of names (character values) of analytic results

Span

A value >0, <=1 defining the proportion of data used to estimate the lowess smooth. The default value (2/3) is the default value for the lowess function.

Value

A set of pairs plots as described above and a list with the following components:

  • usage: A vector with the value of the argument doc, date run, version of R used

  • dataUsed: A data frame with the observations in data restricted to the groups analyzed

  • dataNA: A data frame with observations containing a least one missing value for an analysis variable, NA if no missing values

  • analyticVars: The vector specified by the parameter AnalyticVars

  • params: A list with the values of the grouping and numeric arguments

  • analyticVars: A vector with the value of the argument AnalyticVars

DETAILS

The function produces a pairs plot with a lowess smooth through the scatter plot for each pair of variables in AnalyticVars. If Groups != " ", there is a scatter plot for each group in Groups. If Groups=" ", there is one pairs plot with the data for all groups. Executing the function produces warnings ("span is not a graphical parameter") that can be ignored (changing the value of Span does change the lowess smooths). As coded, in RStudio all plots are produced without a pause; use the back arrow in the plot pane to see the plots. In base R, remove the comment symbol (#) from the browser command at the end of the final loop, so that the function will stop after producing each plot.

Examples


data(ObsidianSources)
analyticVars<-c("Rb","Sr","Y","Zr","Nb")
pairsPlot <- ps_pairsPlot(data=ObsidianSources, GroupVar="Code", Groups="All",
AnalyticVars=analyticVars)


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