ch.plotTwoLinearFits: A function to fit and plot two linear function one over the...

ch.plotTwoLinearFitsR Documentation

A function to fit and plot two linear function one over the other.

Description

This function fits two linear functions; plots the two functions on a single graph; and returns a list with the fit statistics.

Usage

ch.plotTwoLinearFits(
  data,
  xCol,
  y1Col,
  y2Col,
  minN = NULL,
  y1Label = NA,
  y2Label = NA,
  parOp = NULL,
  cex1 = 1.25,
  cex.topTile = 1.25,
  printR2 = T,
  topTitle = NULL,
  ylimMin1 = 0,
  ylimMax1 = 0,
  ylimMin2 = 0,
  ylimMax2 = 0,
  filename = NULL,
  ...
)

Arguments

data

a dataframe.

xCol

a string that specifies the name of the column in "data" that contains the data for the x-axis.

y1Col

a string that specifies the name of the column in "data" that contains the the first DV to be fit.

y2Col

a string that specifies the name of the column in "data" that contains the the second DV to be fit.

minN

an integer indicating the minimum number of trials in each condition that is valid for analysis. Below that number, the condition will be removed. DEFAULT = NULL.

y1Label

a string that specifies the y-axis label name for the y1Fit. DEFAULT = NA.

y2Label

a string that specifies the y-axis label name for the y2Fit. DEFAULT = NA.

parOp

a list with the par options (see par). If NULL, then the functions default par options will be used. DEFAULT = NULL.

cex1

sets the default font size. DEFAULT = 1.25.

cex.topTile

sets the default font size of the title at the top of the page. DEFAULT = 1.25.

printR2

a boolean that determines whether to print the r square on the graph. DEFAULT = FALSE.

topTitle

a string that will be the title at the top of the page. DEFAULT = NULL.

ylimMin1

a number denoting the minimum of the y-axis for graph 1. DEFAULT=0.

ylimMax1

a number denoting the maximum of the y-axis for graph 1. DEFAULT=0. If ylimMin1 == ylimMax1, the function determines a

ylimMin2

a number denoting the minimum of the y-axis for graph 2. DEFAULT=0.

ylimMax2

a number denoting the maximum of the y-axis for graph 2. DEFAULT=0. If ylimMin2 == ylimMax2, the function determines a

filename

the filename (pdf) to save the output of the graph. DEFAULT = NULL (no graph saved)

Value

a list containing: y1Fit = lm object with the fit of the y1 data; y2Fit = the lm object with the fit of the y2 data.

Examples

ch.plotTwoLinearFits (data=moralsData,"overlapRound", "resdRT", "correct", c("yes", "no"), filename = "plot.pdf")

ccpluncw/ccpl_R_chutils documentation built on Feb. 28, 2024, 1:17 a.m.