pdensity.column: Plot density of each column in a dataset.

Description Usage Arguments Value See Also Examples

Description

Computes a kernel density per column in a dataset and makes a single plot with appropriate limits of all densities together. The graph also includes a legend by default.

Usage

1
2
3
4
pdensity.column(mydata, n = 512, mycols = rainbow(ncol(mydata), start = 0.1,
  end = 0.9), na.rm = TRUE, mytitle = "Data density", mytype = "solid",
  myxlab = "observed values", add.leg = TRUE, myleg = colnames(mydata),
  xlim = NULL)

Arguments

mydata

data.matrix which columns are to be made density plots of.

n

the number of knots at which the density is to be computed - see density for details.

mycols

colours to be assigned to the lines of the densities computed. If left empty, rainbow is used to produce one colour per column in mydata.

na.rm

logical - should NAs per column be removed? Its value is passed on to the call to density.

mytitle

string containing the title to be used.

mytype

string indicating the line type to be used. If a single value is given, it is recycled across all lines (one for each column in mydata). If a vector is given, it is expected to be as long as the number of columns in mydata. The default is to use solid lines for all densities. For a list of all possible line types, see graphical parameter lty in the help file for par.

myxlab

string containing the legend to be used for the x-axis.

add.leg

logical. If TRUE, adds a legend to the plot.

myleg

the legend text to be shown. If left empty, and add.leg isTRUE, the column names of mydata are used.

xlim

a numerical vector of length 2 giving the limits to be used for the x axis. If left empty, the range of values in mydata is used.

Value

A plot including one density for each column of values in mydata, using plot limits that allow for a complete displ)ay of each density, by default.

See Also

density, rainbow

Examples

1
2
3
mydata <- cbind(replicate(5, rnorm(500)), replicate(5, rnorm(500, mean=1)))
colnames(mydata) <- paste("Data", 1:10)
pdensity.column(mydata)

rxmenezes/rscreenorm documentation built on May 15, 2019, 1:19 p.m.