Generate a line plot of multiple estimates.
Usage
datLineplot(
x,
xvar,
yvar,
plotCI = FALSE,
sevar = NULL,
CIlst = c(68, 95),
CIcolorlst = c("dark grey", "black"),
addshade = FALSE,
device.type = "dev.new",
jpeg.res = 300,
device.height = 5,
device.width = 8,
ylim = NULL,
divideby = NULL,
ylabel = NULL,
xlabel = NULL,
xticks = NULL,
mar = NULL,
addlegend = FALSE,
main = NULL,
cex.main = 1,
cex.label = 1,
cex.names = 0.9,
las.xnames = 0,
las.ynames = 1,
savedata = FALSE,
outfolder = NULL,
outfn = NULL,
outfn.pre = NULL,
outfn.date = TRUE,
overwrite = FALSE,
...
)
Arguments
- x
Data frame or comma-delimited file (*.csv) - a frequency table.
- xvar
String. Name of X variable.
- yvar
String. Name of the y variable (e.g., FREQ).
- plotCI
Logical. If TRUE, adds confidence intervals to plot as dotted lines.
- sevar
String. Name of the variable with standard error values.
- CIlst
String. Numeric vector. If plotCI=TRUE, identifies percent confidence interval to add to plot.
- CIcolorlst
String. Character vector. If plotCI=TRUE, identifies colors to plot confidence interval lines. Must be same length as CIlst and from colors() list.
- addshade
Logical. If TRUE, adds a light grey shading between the large confidence interval lines.
- device.type
String. Type(s) of device for plotting ("dev.new", "jpg", "pdf").
- jpeg.res
Integer. Resolution for jpeg image.
- device.height
Integer. Height (in inches) of barplot, if writing to file.
- device.width
Integer. Width (in inches) of barplot, if writing to file.
- ylim
Number. A vector of min and max values, c(min,max) for the y axis (or x axis if horiz=TRUE). If NULL, defaults to maximum y value. If errbars=TRUE, the ylim defaults to the maximum y value plus the standard error.
- divideby
String. Conversion number for output ('hundred', 'thousand', 'million').
- ylabel
String. Label for the y axis (same as ylab).
- xlabel
String. Label for the x axis (same as xlab).
- xticks
Numeric vector. Vector of tick marks for x axis.
- mar
See par.. A numerical vector representing number of lines for margins (c(bottom, left, top, right).
- addlegend
Logical. If TRUE, adds legend to bar plot (only applicable if grouping).
- main
String. Title for plot.
- cex.main
Number. Expansion factor for title.
- cex.label
Number. A number representing cex in barplot (size expansion of x and/or ylabels.
- cex.names
Number. Expansion factor for axis names (bar labels) (e.g., 0.5 represents half the size.
- las.xnames
Number. The direction of x variable names (0,1,3). 0:diagonal (Default), 1:horizontal; 3:vertical.
- las.ynames
Number. The direction of y variable names (0,1,3). 0:diagonal (Default), 1:horizontal; 3:vertical.
- savedata
Logical. If TRUE, writes output data to outfolder (jpg and pdf).
- outfolder
String. The name of the output folder. If savedata=TRUE, all output saved to the outfolder. If savedata=FALSE, only a text file of input parameters is saved.
- outfn
String. The name of the output file if savedata=TRUE (*.csv). Do not include extension. If NULL, the file will be named BARPLOT_'yvar_date'.csv
- outfn.pre
String. Add a prefix to output name (e.g., "01").
- outfn.date
Logical. If TRUE, add date to end of outfile (e.g., outfn_'date'.csv).
- overwrite
Logical. If TRUE and exportshp=TRUE, overwrite files in outfolder.
- ...
additional arguments to pass to barplot(), including a list of arguments for legend() arguments (e.g., args.legend=list(x="topleft", "bty="n"), for moving legend to topleft and removing box around legend).
Note
If savedata = TRUE, writes a jpg and pdf of barplot to outfolder.
To add legend parameters, add a parameter named args.legend, defined as a list of specific legend parameters (see ?legend)... ex. .., args.legend=list(x="topright"). If specifying x and y, x defines the lower right corner of legend box and y defines the upper right corner of box.