Last data update: 2014.03.03

R: Plot a Histogram
HistR Documentation

Plot a Histogram

Description

This function is a wrapper for the hist function in the base package, permitting percentage scaling of the vertical axis in addition to frequency and density scaling.

Usage

Hist(x, groups, scale=c("frequency", "percent", "density"), xlab=deparse(substitute(x)), 
    ylab=scale, main="", breaks = "Sturges", ...)

Arguments

x

a vector of values for which a histogram is to be plotted.

groups

a factor to create histograms by group with common horizontal and vertical scales.

scale

the scaling of the vertical axis: "frequency" (the default), "percent", or "density".

xlab

x-axis label, defaults to name of variable.

ylab

y-axis label, defaults to value of scale.

main

main title for graph, defaults to empty.

breaks

see the breaks argument for hist.

...

arguments to be passed to hist.

Value

This function returns NULL, and is called for its side effect — plotting a histogram.

Author(s)

John Fox jfox@mcmaster.ca

See Also

hist

Examples

    data(Prestige, package="car")
    Hist(Prestige$income, scale="percent")
    with(Prestige, Hist(income, groups=type))
    

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RcmdrMisc)
Loading required package: car
Loading required package: sandwich
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RcmdrMisc/Hist.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Hist
> ### Title: Plot a Histogram
> ### Aliases: Hist
> ### Keywords: hplot
> 
> ### ** Examples
> 
>     data(Prestige, package="car")
>     Hist(Prestige$income, scale="percent")
>     with(Prestige, Hist(income, groups=type))
>     
> 
> 
> 
> 
> dev.off()
null device 
          1 
>