Learn R Programming

rgr (version 1.1.15)

inset.exporter: Saves an EDA Graphical and Statistical Summary

Description

Saves the output from function inset as a graphics file in the R Working Directory for use in report or map preparation. Optionally the EDA graphics may be plotted with base 10 logarithmic scaling.

Usage

inset.exporter(x, xlab = deparse(substitute(x)), log = FALSE, 
	xlim = NULL, nclass = NULL, ifnright = TRUE, file = NULL, 
	table.cex = 0.7, gtype = "emf", ...)

Arguments

x

name of the variable to be plotted.

xlab

a label for the x-axis. It is often desirable to replace the default x-axis label of the input variable name text string with a more informative label, e.g., xlab = "Cu (mg/kg) in <2 mm O-horizon soil".

log

to display the data with logarithmic (x-axis) scaling, set log = TRUE.

xlim

default limits of the x-axis are determined in the function. However when used stand-alone the limits may be user-defined by setting xlim, see Note below.

nclass

the default procedure for preparing the histogram is to use the Scott (1979) rule. This usually provides an informative histogram, other optional rules are nclass = "sturges" or nclass = "fd"; the later standing for Freedman-Diaconis (1981), a rule that is resistant to the presence of outliers in the data. See Venables and Ripley (2001) for details, or inset or gx.hist.

ifnright

controls where the sample size is plotted in the histogram display, by default this in the upper right corner of the plot. If the data distribution is such that the upper left corner would be preferable, set ifnright = FALSE. If neither option generates an acceptable plot, setting ifnright = NULL suppresses the display of the data set size.

file

the name of the folder where the files are to be saved, a ‘/’ is appended before the synthesized file name, details of which are displayed on the current device. If no file is specified, the files are saved to the Working Directory, see Details below.

table.cex

controls the size of the text in the central panel of summary statistics table, the default is table.cex = 0.7, which has been found to be optimal. If the entire table does not display, just parts of the columns, see Note below.

gtype

the format of the graphics file to be saved. By default gtype = "emf" for a Windows extended metafile. Other alternatives are gtype = "jpg" for a jpeg file, gtype = "png" for a portable network graphics file, gtype = "ps" for a postscript file, or gtype = "pdf" for a pdf file.

further arguments to be passed to methods. For example, by default individual data points in the CPP plot are marked by a plus sign, pch = 3, if a cross or open circle is desired, then set pch = 4 or pch = 1, respectively. See display.marks for all available symbols. Adding ifqs = TRUE results in horizontal and vertical dotted lines being plotted at the three central quartiles and their values, respectively, in the CPP plot.

Details

See inset for details concerning the inset parameters.

The graphics file will be saved, by default, in the Working Directory. Alternately a folder name may be provided in file. The file name is synthesized from the data frame name, ‘_inset_’, the variable name and ‘.gtype’. This is prefixed with a ‘\’ and concatenated with the folder location.

References

Venables, W.N. and Ripley, B.D., 2001. Modern Applied Statistsis with S-Plus, 3rd Edition, Springer, 501 p. See pp. 119 for a description of histogram bin selection computations.

See Also

inset, ltdl.fix.df For Windows installations see also savePlot

Examples

Run this code
# NOT RUN {
## Make test data available
data(kola.o)
attach(kola.o)

## Usage is as follows
## Saves the graphics as a pdf file to the defined folde.r
## inset.exporter(Cu, xlab = "Cu (mg/kg) in\n<2 mm O-horizon soil", 
##	log = TRUE, gtype = "pdf", file = "D://R_work//Project3")


## Saves a default emf graphics file, kola_o_inset_Cu.emf, in the
## R Working Directory for later use or inclusion in a report or
## map.
inset.exporter(Cu, xlab = "Cu (mg/kg) in\n<2 mm O-horizon soil", 
	log = TRUE)


## Detach test data
detach(kola.o)
# }

Run the code above in your browser using DataLab