What are vectors?
Vector operations
Indexing and filtering
Simple analysis


Well done! The great thing about R is that it also allows you to easily visualize your data. There are lots of built-in functions that are used for plotting. For a numeric vector, you can use a histogram to see the distribution of its elements. In R, a histogram is displayed with the function hist(), which takes a single vector as its argument, e.g.:


After this function call, R will return the following plot:


As you can tell, the elements of our vector have been divided into ranges (in our case, the ranges are 20-25, 25-30, 30-35, 35-40, and 40-45). Each range (called a bucket) has its own corresponding height and represents the number of vector elements that fall within that range. The taller the bucket, the more elements the corresponding range contains.


Let's return to our salary example. Make a histogram for the vector named salaries.