ch.moralsXXYPlotFitsByGrp: A function to plot multiple model fits on one graph

ch.moralsXXYPlotFitsByGrpR Documentation

A function to plot multiple model fits on one graph

Description

This function plots multiple model fits on one graph. The model fits should have one DV, one predictor variable (xCol), and one or two grouping variables (grp1Col & grp2Col)

Usage

ch.moralsXXYPlotFitsByGrp(
  df.models,
  grp1Col,
  grp2Col = NULL,
  xCol,
  data,
  subsetCond = NULL,
  subsetString = NULL,
  addLegend = T,
  filenameID = NULL
)

Arguments

df.models

a models list containing: a dfIndex, created by ch.subsetDFbyGroups() and a series of model fits output by ch.getLmModel() or ch.getPhitModel();

grp1Col

a string that specifies the name of the column in "dfIndex" that contains one grouping variable. This is required.

grp2Col

a string that specifies the name of the column in "dfIndex" that contains another grouping variable. This is optional. A max of two grouping variables is allowed

xCol

a string that specifies the name of the column in "data" that contains the predictor (x) variables for the fit specified in the models.

data

the morals dataframe after running through ch.moralsDataPrep().

subsetCond

an expression that is used to subset df.models$dfIndex to include only the group conditions that you want to graph (e.g., cond1 == "pretest" & sn == "4").

subsetString

an string that mirrors the subsetCond (e.g., "cond1 == pretest & sn == 4"). This is used for titling the graph.

addLegend

a boolean that specifies whether a legend should be added to the graphs. DEFAULT = T

filenameID

a string that will be put on all filenames when the plots are saved. DEFAULT = NULL (no file saved)

Value

.

Examples

ch.moralsXXYPlotFitsByGrp(df.models, "scenarioType", "agent", "overlapRound", moralsData)

ccpluncw/ccpl_R_chMorals documentation built on Feb. 4, 2024, 3:30 p.m.