A histogram represents the frequencies of values of a variable bucketed into ranges. The histogram is similar to a bar chart but the difference is it groups the values into continuous ranges. A simple histogram is created using input vector, label, col, and border parameters. The script given below will create and save the histogram in the current R working directory.
v <- c(9,13,21,8,36,22,12,41,31,33,19)
png(file = "histogram.png")
# Create the histogram.
hist(v,xlab = "Weight",col = "yellow",border = "blue")