codeGK
Code it ALL
R Histogram - CodeGK
♦ R Histogram

♣ About R Histogram

Histogram represents frequency of each entity(plotted on x-axis) on y-axis.
Histogram groups the values of entities into continuous ranges.
R language uses the function hist() function to create a Histogram.

♣ R Histogram Syntax

Below is the representation of R Histogram Syntax.
Basic Syntax
hist(v, main, xlab, xlim, ylim, breaks, col, border)
Syntax Explanation:
Table Info
ParameterUsage
vvector containing numeric values used in Histogram
maintitle of the Histogram
xlablabel for x-axis
xlimused to specify the range of values on the x-axis
ylimused to specify the range of values on the y-axis
breaksassigns width of each bar
colvector specifying color of each bar(optional)
borderused to set border color of each bar(optional)

♣ Example1: Plotting Data using Histogram in R

In this example: Weight(in Kgs) of 20 students in class.
Example
Input:
Output:
Prev_LessonNext_Lesson
R Histogram