Learn R Programming

pscore (version 0.4.0)

ldensity: Density Plot for a Long Dataset

Description

Internal function only, not meant for general use Simple wrapper around ggplot2 functionaly to create density plots, potentially for many variables and coloured by group.

Usage

ldensity(data, melt = FALSE, x, facet, g, hist = FALSE)

Arguments

data

A dataset (or melt()ed dataset)

melt

Logical whether to melt() dataset

x

name of variable for density

facet

A variable to use for facetting

g

A variable to use for grouping/colouring. If melt=TRUE, this is used as id.var as well.

hist

Logical whether to make a density plot or histogram (if TRUE).

Value

A ggplot2 graph.

Examples

Run this code
# NOT RUN {
# simple facetted plot
pscore:::ldensity(mtcars, TRUE)
# simple coloured plot
pscore:::ldensity(mtcars, x = "mpg", g = "cyl")
# }

Run the code above in your browser using DataLab