Description Usage Arguments Details Value Examples
The function Histogram
plots a histogram of a given sample.
1 2 |
x |
a numeric vector containing the sample provided to compute the histogram. |
freq |
a single logical value; if TRUE, the histogram graphic uses absolute frequencies; if FALSE (default), a histogram of area 1 (density) is plotted. |
col.fill |
a single colour to be used to fill the bars; default to grey. |
main |
main title, by default "Histogram" or "Histogram of area 1" depending on the value of the argument freq, TRUE or FALSE respectively. |
xlab |
x-axis label; by default empty. |
ylab |
y-axis label; by default "Frequency" or "Density" depending on the value of the argument freq, TRUE or FALSE respectively. |
The procedure to construct the histogram is detailed below:
- number of intervals: the closest integer to sqrt(n);
- amplitude of each interval: the range of the sample divided by the number of intervals, i.e., the breaks are equidistant and rounded to two decimals;
- height of each bar: by default (freq=FALSE) the plotted histogram is a density (area 1); if freq=TRUE, then the values of the bars are the absolute frequencies.
A list containing the following components:
ni |
a numeric vector containing the absolute frequencies. |
fi |
a numeric vector containing the relative frequencies. |
Ni |
a numeric vector containing the absolute cumulative frequencies. |
Fi |
a numeric vector containing the relative cumulative frequencies. |
tab |
the frequency table. |
Independently on the user saving those values, the function provides the frequency table on the console.
1 2 3 4 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.