Usage
Density(x, data=mydata, n.cat=getOption("n.cat"), Rmd=NULL, bw="nrd0", type=c("both", "general", "normal"),
histogram=TRUE, bin.start=NULL, bin.width=NULL,
fill=getOption("fill.pt"),
bg=getOption("bg"),
grid=getOption("grid"),
box=getOption("box"),
nrm.color="black", gen.color="black",
fill.nrm=NULL, fill.gen=NULL,
cex.axis=0.75, axes="gray30",
rotate.values=0, offset=0.5,
x.pt=NULL, xlab=NULL, main=NULL, sub=NULL, y.axis=FALSE,
x.min=NULL, x.max=NULL, band=FALSE,
digits.d=NULL, quiet=getOption("quiet"),
width=4.5, height=4.5, pdf=FALSE,
fun.call=NULL, …)
dn(…)
Arguments
x
Variable(s) to analyze. Can be a single numerical variable,
either within a data frame or as a vector in the user's workspace,
or multiple variables in a data frame such as designated with the
c
function, or an entire data frame. If not specified,
then defaults to all numerical variables in the specified data
frame, mydata
by default. data
Optional data frame that contains the variable(s) of interest,
default is mydata
.
n.cat
For the analysis of multiple variables, such as a data frame,
specifies the largest number of unique values of variable of a numeric data
type for which the variable will be analyzed as categorical. Default is 0.
Rmd
File name for the file of R markdown to be written, if specified.
The file type is .Rmd, which automatically opens in RStudio, but it is a
simple text file that can be edited with any text editor, including
RStudio.
bw
Bandwidth of kernel estimation.
type
Type of density curve plotted. By default, both the general
density and the normal density are plotted.
histogram
If TRUE
overlay the density plot over a histogram.
bin.start
Optional specified starting value of the bins.
bin.width
Optional specified bin width, which can be specified with or
without a bin.start
value.
fill
Default (for default color theme of "dodgerblue"
) is to
display the histogram in a light gray. To suppress, the histogram,
specify a color of "transparent"
.
bg
Color of the plot background.
grid
Color of the grid lines.
box
Color of border around the plot background, the box, that encloses
the plot, with a default of "black"
.
nrm.color
Color of the normal curve.
gen.color
Color of the general density curve.
fill.nrm
Fill color for the estimated normal curve, with a partially
transparent blue as the default, and transparent for the gray theme.
fill.gen
Fill color for the estimated general density curve, with a
partially transparent light red as the default, and a light transparent
gray for the gray theme.
cex.axis
Scale magnification factor, which by default displays the axis
values to be smaller than the axis labels.
axes
Color of the font used to label the axis values.
rotate.values
Degrees that the axis values are rotated, usually to
accommodate longer values, typically used in conjunction with offset
.
offset
The amount of spacing between the axis values and the axis. Default
is 0.5. Larger values such as 1.0 are used to create space for the label when
longer axis value names are rotated.
x.pt
Value of the point on the x-axis for which to draw a unit interval
around illustrating the corresponding area under the general density curve.
Only applies when requesting type=general
.
sub
Sub-title of graph, below xlab.
y.axis
Specifies if the y-axis, the density axis, should be included.
x.min
Smallest value of the variable x plotted on the x-axis.
x.max
Largest value of the variable x plotted on the x-axis.
band
If TRUE
, add a rug plot, a direct display of density in the
form of a narrow band beneath the density curve.
digits.d
Number of significant digits for each of the displayed summary
statistics.
quiet
If set to TRUE
, no text output. Can change system default
with theme
function. width
Width of the plot window in inches, defaults to 4.5.
height
Height of the plot window in inches, defaults to 4.5.
pdf
If TRUE
, graphics are to be redirected to a pdf file.
fun.call
Function call. Used with knitr
to pass the function call when
obtained from the abbreviated function call dn
.
…
Other parameter values for graphics as defined processed
by plot
, including xlim
, ylim
, lwd
and cex.lab
,
color.main
, color.lab
, sub
,
color.sub
, and color.ticks
to specify the color of
the ticks used to label the axis values, density
, for the general
density calculations, can set bandwidth with the standard bw
.