Lineplot of the mean and standard error (or other summary statistics) of a response variable for one-way or higher experimental designs.
lineplot.CI(x.factor, response, group=NULL, type="b", xlab=NULL, ylab=NULL,
x.cont=FALSE, legend=TRUE, leg.lab=NULL, fixed=FALSE,
x.leg=NULL, y.leg=NULL, cex.leg=1, ncol=1,
pch=c(16, 21, 15, 22, 17, 24, c(3:14)),
fun = function(x) mean(x, na.rm=TRUE),
ci.fun= function(x) c(fun(x)-se(x), fun(x)+se(x)),
err.width = if(length(levels(as.factor(x.factor))) > 10) 0 else 0.1,
err.col = col, err.lty = 1,
xlim=NULL, ylim=NULL, cex=NULL, lwd=NULL, col="black", cex.axis=1,
xaxt="s", data=NULL, subset=NULL, ...)
a factor (required) whose levels will form the x axis.
a numeric variable giving the response.
grouping factor (optional) whose levels will form the traces.
the type of plot: lines, points, or both. Defaults to both.
default x-axis label. If not specified will parse name from x.factor. To leave blank set to NA
default y-axis label. If not specified will parse name from response. To leave blank set to NA
logical. Treat x.factor as a continuous variable?
logical. Should a legend be included?
legend labels for trace factors.
logical. Should the legend be in the order of the levels of 'trace.factor' or in the order of the traces at their right-hand ends?
optional values to over ride the default legend placement.
character expansion value for legend labels.
number of columns to use for legend.
a vector of plotting symbols or characters.
the function to compute the summary statistic. Should return a single real value. Defaults to mean with NA values removed.
the functions to compute the CI. Should return a vector of length 2 defining the lower and upper limits of the CI's. Defaults to the mean +/- 1 standard error, with NA values removed.
set width of whiskers for error bars.
color for error bars. Defaults to col.
line type for error bars.
range for x and y axes.
overall plot character expansion value.
deterimines line width.
default color(s) for plot.
character expansion value for axis labels.
should x-axis be drawn?
an optional data frame.
an optional expression indicating the subset of the rows of 'data' that should be used in the plot.
further graphical parameters.
Plots a response as a function of treatment (factor) combinations for one-way and higher designs. This is a "wrapper" function for plot in one-way designs and interaction.plot in higher-way designs that adds confidence intervals - those functions should be consulted for details. Notable changes from the defaults for interaction.plot include the removal of NA values by default, options to specify a subset of data and greater flexibility in the placement of legends. This function replicates some of the functionality of plotmeans from the package gplots, with differences in the treatment of two-way and higher designs.
interaction.plot
, se
# NOT RUN {
data(ToothGrowth)
# One way design
lineplot.CI(x.factor = dose, response = len, data = ToothGrowth)
# Two-way design with options
lineplot.CI(dose, len, group = supp, data = ToothGrowth, cex = 2,
xlab = "Dose", ylab = "Growth", cex.lab = 1.5, x.leg = 1,
col = c("blue","red"), pch = c(16,16))
# }
Run the code above in your browser using DataLab